Skip to content

Commit d2fcdea

Browse files
Default to current year instead of 2020
1 parent ef1dfa4 commit d2fcdea

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Next
4+
- Default to the current year instead of 2020 for year-less date inputs
5+
36
## 2.14.1 - 2024 Nov 6
47
- Fix value bindings not always causing updates (@asdfghjkkl11)
58

src/lib/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function parse(str: string, tokens: FormatToken[], baseDate: Date | null)
1919
let missingPunctuation = ''
2020
let valid = true
2121

22-
baseDate = baseDate || new Date(2020, 0, 1, 0, 0, 0, 0)
22+
baseDate = baseDate || new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
2323
let year = baseDate.getFullYear()
2424
let month = baseDate.getMonth()
2525
let day = baseDate.getDate()

0 commit comments

Comments
 (0)