Skip to content

Commit

Permalink
Add missing padding to 'YYYY' format
Browse files Browse the repository at this point in the history
Adds padding to the year component when formatted with `'YYYY'`, similar to how padding is handled for '`MM`' and '`DD`'.

Fixes #2230
  • Loading branch information
Sharparam authored Feb 7, 2023
1 parent e70bee7 commit 37dbef2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Dayjs {

const matches = {
YY: String(this.$y).slice(-2),
YYYY: this.$y,
YYYY: Utils.s(this.$y, 4, '0'),
M: $M + 1,
MM: Utils.s($M + 1, 2, '0'),
MMM: getShort(locale.monthsShort, $M, months, 3),
Expand Down

0 comments on commit 37dbef2

Please sign in to comment.