Skip to content

Commit 8d330b1

Browse files
authored
Adding padding for the weeks (W)
Adding a WW option which pads week
1 parent 76482b3 commit 8d330b1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/dateformat.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
(function (global) {
1616
const dateFormat = (() => {
17-
const token = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LlopSZWN]|"[^"]*"|'[^']*'/g;
17+
const token = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g;
1818
const timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
1919
const timezoneClip = /[^-+\dA-Z]/g;
2020

@@ -141,6 +141,7 @@
141141
d() % 10 > 3 ? 0 : (((d() % 100) - (d() % 10) != 10) * d()) % 10
142142
],
143143
W: () => W(),
144+
WW: () => pad( W() ),
144145
N: () => N(),
145146
};
146147

0 commit comments

Comments
 (0)