Fix #324: Handle numeric YAML parsing for startDate/endDate with YYYYMMDD format #539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #324 - Fixes issue where
dateFormat: YYYYMMDDmadestartDateandendDateineffective, causing all files to be included regardless of the date range.Root cause: YAML parsers may parse numeric-looking dates (e.g.,
20240201) as numbers instead of strings. The code only checkedtypeof === 'string', so numeric values were skipped, leavingstartDate/endDateasnull.Changes
parsing.tsto handle both string and number types forstartDate/endDate, converting numbers to strings before processingmain.tsto useisBefore/isAfterwith 'day' granularity for clearer, more readable date comparisonsstartDate/endDatein local variables before async file processing loophelper.tsbug: changed.contains()to.includes()for string method compatibilityType of Change
How Has This Been Tested?
test/date-format-yyyymmdd.test.ts) - 10 tests for date parsing and comparisontest/parsing-yyyymmdd.test.ts) - 4 tests for YAML parsing with YYYYMMDD formattest/edge-cases-date-filtering.test.ts) - 8 tests for boundary conditions, missing dates, year/month boundariestest/date-comparison-methods.test.ts) - 6 tests comparing different date comparison approachesDocumentation
Related Issue
Closes #324