esday 0.4.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/LICENSE +21 -0
  3. package/README.md +63 -33
  4. package/chunks/AyQQ6US-.js +84 -0
  5. package/chunks/BkjWOpMU.js +68 -0
  6. package/chunks/C5qDMHT5.d.ts +6 -0
  7. package/chunks/CODi8AFH.d.ts +231 -0
  8. package/chunks/CXWzCl3n.js +481 -0
  9. package/chunks/CdvTtmWL.js +56 -0
  10. package/chunks/Shk32pTP.js +9 -0
  11. package/chunks/v_QBn7Xm.js +25 -0
  12. package/chunks/xt8C2lbv.js +38 -0
  13. package/index.d.mts +3 -0
  14. package/index.mjs +3 -0
  15. package/locales/af.d.mts +6 -0
  16. package/locales/af.mjs +108 -0
  17. package/locales/am.d.mts +6 -0
  18. package/locales/am.mjs +108 -0
  19. package/locales/ar-dz.d.mts +9 -0
  20. package/locales/ar-dz.mjs +30 -0
  21. package/locales/ar-iq.d.mts +9 -0
  22. package/locales/ar-iq.mjs +12 -0
  23. package/locales/ar-kw.d.mts +9 -0
  24. package/locales/ar-kw.mjs +26 -0
  25. package/locales/ar-ly.d.mts +9 -0
  26. package/locales/ar-ly.mjs +12 -0
  27. package/locales/ar-ma.d.mts +9 -0
  28. package/locales/ar-ma.mjs +27 -0
  29. package/locales/ar-sa.d.mts +9 -0
  30. package/locales/ar-sa.mjs +27 -0
  31. package/locales/ar-tn.d.mts +9 -0
  32. package/locales/ar-tn.mjs +27 -0
  33. package/locales/ar.d.mts +6 -0
  34. package/locales/ar.mjs +198 -0
  35. package/locales/az.d.mts +6 -0
  36. package/locales/az.mjs +108 -0
  37. package/locales/be.d.mts +6 -0
  38. package/locales/be.mjs +136 -0
  39. package/locales/bg.d.mts +6 -0
  40. package/locales/bg.mjs +127 -0
  41. package/locales/bi.d.mts +6 -0
  42. package/locales/bi.mjs +108 -0
  43. package/locales/bm.d.mts +6 -0
  44. package/locales/bm.mjs +108 -0
  45. package/locales/bn-bd.d.mts +9 -0
  46. package/locales/bn-bd.mjs +22 -0
  47. package/locales/bn.d.mts +6 -0
  48. package/locales/bn.mjs +137 -0
  49. package/locales/bo.d.mts +6 -0
  50. package/locales/bo.mjs +108 -0
  51. package/locales/br.d.mts +6 -0
  52. package/locales/br.mjs +180 -0
  53. package/locales/bs.d.mts +6 -0
  54. package/locales/bs.mjs +130 -0
  55. package/locales/ca.d.mts +6 -0
  56. package/locales/ca.mjs +142 -0
  57. package/locales/cs.d.mts +6 -0
  58. package/locales/cs.mjs +186 -0
  59. package/locales/cv.d.mts +6 -0
  60. package/locales/cv.mjs +108 -0
  61. package/locales/cy.d.mts +6 -0
  62. package/locales/cy.mjs +108 -0
  63. package/locales/da.d.mts +6 -0
  64. package/locales/da.mjs +108 -0
  65. package/locales/de-at.d.mts +9 -0
  66. package/locales/de-at.mjs +42 -0
  67. package/locales/de-ch.d.mts +9 -0
  68. package/locales/de-ch.mjs +12 -0
  69. package/locales/de.d.mts +6 -0
  70. package/locales/de.mjs +131 -0
  71. package/locales/dv.d.mts +6 -0
  72. package/locales/dv.mjs +108 -0
  73. package/locales/el.d.mts +6 -0
  74. package/locales/el.mjs +117 -0
  75. package/locales/en-au.d.mts +9 -0
  76. package/locales/en-au.mjs +26 -0
  77. package/locales/en-ca.d.mts +9 -0
  78. package/locales/en-ca.mjs +26 -0
  79. package/locales/en-gb.d.mts +11 -0
  80. package/locales/en-gb.mjs +29 -0
  81. package/locales/en-ie.d.mts +9 -0
  82. package/locales/en-ie.mjs +25 -0
  83. package/locales/en-il.d.mts +9 -0
  84. package/locales/en-il.mjs +27 -0
  85. package/locales/en-in.d.mts +9 -0
  86. package/locales/en-in.mjs +25 -0
  87. package/locales/en-nz.d.mts +9 -0
  88. package/locales/en-nz.mjs +27 -0
  89. package/locales/en-sg.d.mts +9 -0
  90. package/locales/en-sg.mjs +27 -0
  91. package/locales/en-tt.d.mts +9 -0
  92. package/locales/en-tt.mjs +27 -0
  93. package/locales/en-us.d.mts +9 -0
  94. package/locales/en-us.mjs +12 -0
  95. package/locales/en.d.mts +6 -0
  96. package/locales/en.mjs +117 -0
  97. package/locales/eo.d.mts +6 -0
  98. package/locales/eo.mjs +108 -0
  99. package/locales/es-do.d.mts +9 -0
  100. package/locales/es-do.mjs +25 -0
  101. package/locales/es-mx.d.mts +9 -0
  102. package/locales/es-mx.mjs +13 -0
  103. package/locales/es-pr.d.mts +9 -0
  104. package/locales/es-pr.mjs +16 -0
  105. package/locales/es-us.d.mts +9 -0
  106. package/locales/es-us.mjs +12 -0
  107. package/locales/es.d.mts +6 -0
  108. package/locales/es.mjs +118 -0
  109. package/locales/et.d.mts +6 -0
  110. package/locales/et.mjs +146 -0
  111. package/locales/eu.d.mts +6 -0
  112. package/locales/eu.mjs +108 -0
  113. package/locales/fa.d.mts +6 -0
  114. package/locales/fa.mjs +108 -0
  115. package/locales/fi.d.mts +6 -0
  116. package/locales/fi.mjs +171 -0
  117. package/locales/fil.d.mts +6 -0
  118. package/locales/fil.mjs +108 -0
  119. package/locales/fo.d.mts +6 -0
  120. package/locales/fo.mjs +108 -0
  121. package/locales/fr-ca.d.mts +9 -0
  122. package/locales/fr-ca.mjs +16 -0
  123. package/locales/fr-ch.d.mts +9 -0
  124. package/locales/fr-ch.mjs +16 -0
  125. package/locales/fr.d.mts +6 -0
  126. package/locales/fr.mjs +110 -0
  127. package/locales/fy.d.mts +6 -0
  128. package/locales/fy.mjs +108 -0
  129. package/locales/ga.d.mts +6 -0
  130. package/locales/ga.mjs +108 -0
  131. package/locales/gd.d.mts +6 -0
  132. package/locales/gd.mjs +108 -0
  133. package/locales/gl.d.mts +6 -0
  134. package/locales/gl.mjs +118 -0
  135. package/locales/gom-deva.d.mts +6 -0
  136. package/locales/gom-deva.mjs +148 -0
  137. package/locales/gom-latn.d.mts +6 -0
  138. package/locales/gom-latn.mjs +148 -0
  139. package/locales/gu.d.mts +6 -0
  140. package/locales/gu.mjs +108 -0
  141. package/locales/he.d.mts +6 -0
  142. package/locales/he.mjs +132 -0
  143. package/locales/hi.d.mts +6 -0
  144. package/locales/hi.mjs +124 -0
  145. package/locales/hr.d.mts +6 -0
  146. package/locales/hr.mjs +195 -0
  147. package/locales/ht.d.mts +6 -0
  148. package/locales/ht.mjs +108 -0
  149. package/locales/hu.d.mts +6 -0
  150. package/locales/hu.mjs +144 -0
  151. package/locales/hy-am.d.mts +6 -0
  152. package/locales/hy-am.mjs +126 -0
  153. package/locales/id.d.mts +6 -0
  154. package/locales/id.mjs +108 -0
  155. package/locales/is.d.mts +6 -0
  156. package/locales/is.mjs +167 -0
  157. package/locales/it-ch.d.mts +9 -0
  158. package/locales/it-ch.mjs +27 -0
  159. package/locales/it.d.mts +6 -0
  160. package/locales/it.mjs +121 -0
  161. package/locales/ja.d.mts +12 -0
  162. package/locales/ja.mjs +111 -0
  163. package/locales/jv.d.mts +6 -0
  164. package/locales/jv.mjs +108 -0
  165. package/locales/ka.d.mts +6 -0
  166. package/locales/ka.mjs +125 -0
  167. package/locales/kk.d.mts +6 -0
  168. package/locales/kk.mjs +108 -0
  169. package/locales/km.d.mts +6 -0
  170. package/locales/km.mjs +108 -0
  171. package/locales/kn.d.mts +6 -0
  172. package/locales/kn.mjs +108 -0
  173. package/locales/ko.d.mts +6 -0
  174. package/locales/ko.mjs +107 -0
  175. package/locales/ku.d.mts +6 -0
  176. package/locales/ku.mjs +121 -0
  177. package/locales/ky.d.mts +6 -0
  178. package/locales/ky.mjs +108 -0
  179. package/locales/lb.d.mts +6 -0
  180. package/locales/lb.mjs +169 -0
  181. package/locales/lo.d.mts +6 -0
  182. package/locales/lo.mjs +107 -0
  183. package/locales/lt.d.mts +6 -0
  184. package/locales/lt.mjs +108 -0
  185. package/locales/lv.d.mts +6 -0
  186. package/locales/lv.mjs +108 -0
  187. package/locales/me.d.mts +6 -0
  188. package/locales/me.mjs +129 -0
  189. package/locales/mi.d.mts +6 -0
  190. package/locales/mi.mjs +108 -0
  191. package/locales/mk.d.mts +6 -0
  192. package/locales/mk.mjs +119 -0
  193. package/locales/ml.d.mts +6 -0
  194. package/locales/ml.mjs +111 -0
  195. package/locales/mn.d.mts +6 -0
  196. package/locales/mn.mjs +127 -0
  197. package/locales/mr.d.mts +6 -0
  198. package/locales/mr.mjs +229 -0
  199. package/locales/ms-my.d.mts +9 -0
  200. package/locales/ms-my.mjs +12 -0
  201. package/locales/ms.d.mts +6 -0
  202. package/locales/ms.mjs +108 -0
  203. package/locales/mt.d.mts +6 -0
  204. package/locales/mt.mjs +108 -0
  205. package/locales/my.d.mts +6 -0
  206. package/locales/my.mjs +134 -0
  207. package/locales/nb.d.mts +6 -0
  208. package/locales/nb.mjs +108 -0
  209. package/locales/ne.d.mts +6 -0
  210. package/locales/ne.mjs +108 -0
  211. package/locales/nl-be.d.mts +9 -0
  212. package/locales/nl-be.mjs +16 -0
  213. package/locales/nl.d.mts +6 -0
  214. package/locales/nl.mjs +108 -0
  215. package/locales/nn.d.mts +6 -0
  216. package/locales/nn.mjs +108 -0
  217. package/locales/oc-lnc.d.mts +6 -0
  218. package/locales/oc-lnc.mjs +125 -0
  219. package/locales/pa-in.d.mts +6 -0
  220. package/locales/pa-in.mjs +125 -0
  221. package/locales/pl.d.mts +6 -0
  222. package/locales/pl.mjs +162 -0
  223. package/locales/pt-br.d.mts +9 -0
  224. package/locales/pt-br.mjs +51 -0
  225. package/locales/pt.d.mts +6 -0
  226. package/locales/pt.mjs +110 -0
  227. package/locales/rn.d.mts +6 -0
  228. package/locales/rn.mjs +108 -0
  229. package/locales/ro.d.mts +6 -0
  230. package/locales/ro.mjs +108 -0
  231. package/locales/ru.d.mts +12 -0
  232. package/locales/ru.mjs +237 -0
  233. package/locales/rw.d.mts +6 -0
  234. package/locales/rw.mjs +108 -0
  235. package/locales/sd.d.mts +6 -0
  236. package/locales/sd.mjs +108 -0
  237. package/locales/se.d.mts +6 -0
  238. package/locales/se.mjs +108 -0
  239. package/locales/si.d.mts +6 -0
  240. package/locales/si.mjs +108 -0
  241. package/locales/sk.d.mts +6 -0
  242. package/locales/sk.mjs +168 -0
  243. package/locales/sl.d.mts +6 -0
  244. package/locales/sl.mjs +177 -0
  245. package/locales/sq.d.mts +6 -0
  246. package/locales/sq.mjs +108 -0
  247. package/locales/sr-cyrl.d.mts +9 -0
  248. package/locales/sr-cyrl.mjs +174 -0
  249. package/locales/sr.d.mts +6 -0
  250. package/locales/sr.mjs +186 -0
  251. package/locales/ss.d.mts +6 -0
  252. package/locales/ss.mjs +110 -0
  253. package/locales/sv-fi.d.mts +9 -0
  254. package/locales/sv-fi.mjs +25 -0
  255. package/locales/sv.d.mts +6 -0
  256. package/locales/sv.mjs +111 -0
  257. package/locales/sw.d.mts +6 -0
  258. package/locales/sw.mjs +108 -0
  259. package/locales/ta.d.mts +6 -0
  260. package/locales/ta.mjs +139 -0
  261. package/locales/te.d.mts +6 -0
  262. package/locales/te.mjs +111 -0
  263. package/locales/tet.d.mts +6 -0
  264. package/locales/tet.mjs +111 -0
  265. package/locales/tg.d.mts +6 -0
  266. package/locales/tg.mjs +127 -0
  267. package/locales/th.d.mts +6 -0
  268. package/locales/th.mjs +108 -0
  269. package/locales/tk.d.mts +6 -0
  270. package/locales/tk.mjs +135 -0
  271. package/locales/tl-ph.d.mts +6 -0
  272. package/locales/tl-ph.mjs +108 -0
  273. package/locales/tlh.d.mts +6 -0
  274. package/locales/tlh.mjs +155 -0
  275. package/locales/tr.d.mts +6 -0
  276. package/locales/tr.mjs +135 -0
  277. package/locales/tzl.d.mts +6 -0
  278. package/locales/tzl.mjs +125 -0
  279. package/locales/tzm-latn.d.mts +9 -0
  280. package/locales/tzm-latn.mjs +68 -0
  281. package/locales/tzm.d.mts +6 -0
  282. package/locales/tzm.mjs +108 -0
  283. package/locales/ug-cn.d.mts +6 -0
  284. package/locales/ug-cn.mjs +113 -0
  285. package/locales/uk.d.mts +6 -0
  286. package/locales/uk.mjs +199 -0
  287. package/locales/ur.d.mts +6 -0
  288. package/locales/ur.mjs +110 -0
  289. package/locales/uz-latn.d.mts +9 -0
  290. package/locales/uz-latn.mjs +68 -0
  291. package/locales/uz.d.mts +6 -0
  292. package/locales/uz.mjs +108 -0
  293. package/locales/vi.d.mts +6 -0
  294. package/locales/vi.mjs +108 -0
  295. package/locales/x-pseudo.d.mts +6 -0
  296. package/locales/x-pseudo.mjs +111 -0
  297. package/locales/yo.d.mts +6 -0
  298. package/locales/yo.mjs +108 -0
  299. package/locales/zh-cn.d.mts +9 -0
  300. package/locales/zh-cn.mjs +12 -0
  301. package/locales/zh-hk.d.mts +9 -0
  302. package/locales/zh-hk.mjs +21 -0
  303. package/locales/zh-mo.d.mts +9 -0
  304. package/locales/zh-mo.mjs +21 -0
  305. package/locales/zh-tw.d.mts +9 -0
  306. package/locales/zh-tw.mjs +21 -0
  307. package/locales/zh.d.mts +12 -0
  308. package/locales/zh.mjs +129 -0
  309. package/package.json +61 -29
  310. package/plugins/advancedFormat/index.d.mts +6 -0
  311. package/plugins/advancedFormat/index.mjs +18 -0
  312. package/plugins/advancedParse/index.d.mts +6 -0
  313. package/plugins/advancedParse/index.mjs +407 -0
  314. package/plugins/calendar/index.d.mts +12 -0
  315. package/plugins/calendar/index.mjs +32 -0
  316. package/plugins/dayOfYear/index.d.mts +12 -0
  317. package/plugins/dayOfYear/index.mjs +11 -0
  318. package/plugins/duration/index.d.mts +78 -0
  319. package/plugins/duration/index.mjs +477 -0
  320. package/plugins/isBetween/index.d.mts +22 -0
  321. package/plugins/isBetween/index.mjs +15 -0
  322. package/plugins/isLeapYear/index.d.mts +11 -0
  323. package/plugins/isLeapYear/index.mjs +10 -0
  324. package/plugins/isSameOrAfter/index.d.mts +11 -0
  325. package/plugins/isSameOrAfter/index.mjs +9 -0
  326. package/plugins/isSameOrBefore/index.d.mts +11 -0
  327. package/plugins/isSameOrBefore/index.mjs +9 -0
  328. package/plugins/isToday/index.d.mts +11 -0
  329. package/plugins/isToday/index.mjs +11 -0
  330. package/plugins/isTomorrow/index.d.mts +11 -0
  331. package/plugins/isTomorrow/index.mjs +13 -0
  332. package/plugins/isYesterday/index.d.mts +11 -0
  333. package/plugins/isYesterday/index.mjs +13 -0
  334. package/plugins/isoWeek/index.d.mts +19 -0
  335. package/plugins/isoWeek/index.mjs +228 -0
  336. package/plugins/locale/index.d.mts +104 -0
  337. package/plugins/locale/index.mjs +141 -0
  338. package/plugins/localeData/index.d.mts +6 -0
  339. package/plugins/localeData/index.mjs +155 -0
  340. package/plugins/localizedFormat/index.d.mts +6 -0
  341. package/plugins/localizedFormat/index.mjs +83 -0
  342. package/plugins/localizedParse/index.d.mts +6 -0
  343. package/plugins/localizedParse/index.mjs +217 -0
  344. package/plugins/minMax/index.d.mts +12 -0
  345. package/plugins/minMax/index.mjs +21 -0
  346. package/plugins/objectSupport/index.d.mts +6 -0
  347. package/plugins/objectSupport/index.mjs +99 -0
  348. package/plugins/pluralGetSet/index.d.mts +18 -0
  349. package/plugins/pluralGetSet/index.mjs +15 -0
  350. package/plugins/quarterOfYear/index.d.mts +14 -0
  351. package/plugins/quarterOfYear/index.mjs +51 -0
  352. package/plugins/relativeTime/index.d.mts +47 -0
  353. package/plugins/relativeTime/index.mjs +187 -0
  354. package/plugins/timezone/index.d.mts +6 -0
  355. package/plugins/timezone/index.mjs +456 -0
  356. package/plugins/toArray/index.d.mts +11 -0
  357. package/plugins/toArray/index.mjs +17 -0
  358. package/plugins/toObject/index.d.mts +19 -0
  359. package/plugins/toObject/index.mjs +17 -0
  360. package/plugins/utc/index.d.mts +18 -0
  361. package/plugins/utc/index.mjs +192 -0
  362. package/plugins/week/index.d.mts +19 -0
  363. package/plugins/week/index.mjs +350 -0
  364. package/EsDay-KXQgnL1r.d.ts +0 -89
  365. package/chunk-MLKGABMK.js +0 -7
  366. package/chunk-NUV73YDM.js +0 -60
  367. package/chunk-SQBPUYUY.js +0 -140
  368. package/index.d.ts +0 -6
  369. package/index.js +0 -310
  370. package/locales/en.d.ts +0 -6
  371. package/locales/en.js +0 -1
  372. package/locales/zh.d.ts +0 -6
  373. package/locales/zh.js +0 -64
  374. package/plugins/customParseFormat/index.d.ts +0 -5
  375. package/plugins/customParseFormat/index.js +0 -159
  376. package/plugins/isToday/index.d.ts +0 -10
  377. package/plugins/isToday/index.js +0 -8
  378. package/plugins/locale/index.d.ts +0 -75
  379. package/plugins/locale/index.js +0 -70
  380. package/plugins/utc/index.d.ts +0 -22
  381. package/plugins/utc/index.js +0 -40
@@ -0,0 +1,19 @@
1
+ import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
2
+
3
+ //#region src/plugins/toObject/index.d.ts
4
+ declare module 'esday' {
5
+ interface EsDay {
6
+ toObject: () => {
7
+ years: number;
8
+ months: number;
9
+ date: number;
10
+ hours: number;
11
+ minutes: number;
12
+ seconds: number;
13
+ milliseconds: number;
14
+ };
15
+ }
16
+ }
17
+ declare const toObjectPlugin: EsDayPlugin<{}>;
18
+ //#endregion
19
+ export { toObjectPlugin as default };
@@ -0,0 +1,17 @@
1
+ //#region src/plugins/toObject/index.ts
2
+ const toObjectPlugin = (_, dayClass) => {
3
+ dayClass.prototype.toObject = function() {
4
+ return {
5
+ years: this.year(),
6
+ months: this.month(),
7
+ date: this.date(),
8
+ hours: this.hour(),
9
+ minutes: this.minute(),
10
+ seconds: this.second(),
11
+ milliseconds: this.millisecond()
12
+ };
13
+ };
14
+ };
15
+
16
+ //#endregion
17
+ export { toObjectPlugin as default };
@@ -0,0 +1,18 @@
1
+ import { h as SimpleType, o as EsDayPlugin, r as DateType } from "../../chunks/CODi8AFH.js";
2
+
3
+ //#region src/plugins/utc/index.d.ts
4
+ declare module 'esday' {
5
+ interface EsDay {
6
+ utc: (keepLocalTime?: boolean) => EsDay;
7
+ local: () => EsDay;
8
+ isUTC: () => boolean;
9
+ }
10
+ interface EsDayFactory {
11
+ utc: (date?: DateType, ...others: (SimpleType | string[] | {
12
+ [key: string]: SimpleType;
13
+ })[]) => EsDay;
14
+ }
15
+ }
16
+ declare const utcPlugin: EsDayPlugin<{}>;
17
+ //#endregion
18
+ export { utcPlugin as default };
@@ -0,0 +1,192 @@
1
+ import { p as constants_default } from "../../chunks/BkjWOpMU.js";
2
+ import { a as isUndefined, r as isObject } from "../../chunks/v_QBn7Xm.js";
3
+ import { n as normalizeUnitWithPlurals } from "../../chunks/AyQQ6US-.js";
4
+ import { a as setUnitInDateUTC, n as getUnitInDateUTC } from "../../chunks/xt8C2lbv.js";
5
+ import { t as createInstanceFromExist } from "../../chunks/Shk32pTP.js";
6
+
7
+ //#region src/plugins/utc/index.ts
8
+ const REGEX_VALID_OFFSET_FORMAT = /[+-]\d\d(?::?\d\d)?/g;
9
+ const REGEX_OFFSET_HOURS_MINUTES_FORMAT = /[+-]|\d\d/g;
10
+ function offsetFromString(value = "") {
11
+ const offset = value.match(REGEX_VALID_OFFSET_FORMAT);
12
+ if (!offset) return NaN;
13
+ const [indicator, hoursOffset, minutesOffset] = Object.assign([
14
+ "-",
15
+ 0,
16
+ 0
17
+ ], `${offset[0]}`.match(REGEX_OFFSET_HOURS_MINUTES_FORMAT));
18
+ const totalOffsetInMinutes = +hoursOffset * 60 + +minutesOffset;
19
+ if (totalOffsetInMinutes === 0) return 0;
20
+ return indicator === "+" ? totalOffsetInMinutes : -totalOffsetInMinutes;
21
+ }
22
+ function utcOffsetGetImpl(that, defaultValue = NaN) {
23
+ if (that["$conf"].utc) return 0;
24
+ if (that["$conf"].utcOffset !== void 0) return Number(that["$conf"].utcOffset);
25
+ return defaultValue;
26
+ }
27
+ function utcOffsetSetImpl(that, offset, keepLocalTime) {
28
+ let offsetAsNumber;
29
+ if (typeof offset === "string") {
30
+ offsetAsNumber = offsetFromString(offset);
31
+ if (Number.isNaN(offsetAsNumber)) return that;
32
+ } else offsetAsNumber = offset;
33
+ const offsetAsMinutes = Math.abs(offsetAsNumber) <= 16 ? offsetAsNumber * 60 : offsetAsNumber;
34
+ if (keepLocalTime) {
35
+ const localTimezoneOffset = that["$conf"].utc ? that.toDate().getTimezoneOffset() : -1 * that.utcOffset();
36
+ let instance = that;
37
+ if (that["$conf"].utc) {
38
+ instance = instance.add(localTimezoneOffset, constants_default.MIN);
39
+ instance["$conf"].utc = offsetAsMinutes === 0;
40
+ }
41
+ instance["$conf"].utcOffset = offsetAsMinutes;
42
+ instance["$conf"].localOffset = localTimezoneOffset;
43
+ return instance;
44
+ }
45
+ if (offsetAsNumber !== 0) {
46
+ const localTimezoneOffset = that["$conf"].utc ? that.toDate().getTimezoneOffset() : -1 * that.utcOffset();
47
+ const instance = that.local().add(offsetAsMinutes + localTimezoneOffset, constants_default.MIN);
48
+ instance["$conf"].utcOffset = offsetAsMinutes;
49
+ instance["$conf"].localOffset = localTimezoneOffset;
50
+ return instance;
51
+ }
52
+ return that.utc();
53
+ }
54
+ function addUtc(that, value, units) {
55
+ const $d = that["$d"];
56
+ const unit = normalizeUnitWithPlurals(units);
57
+ const instanceFactorySet = (multiplier) => {
58
+ return that.set("date", that.get("date") + Math.round(multiplier * value));
59
+ };
60
+ switch (normalizeUnitWithPlurals(unit)) {
61
+ case constants_default.YEAR: return that.set("year", that.get("year") + value);
62
+ case constants_default.MONTH: return that.set("month", that.get("month") + value);
63
+ case constants_default.WEEK: return instanceFactorySet(7);
64
+ case constants_default.DAY:
65
+ case constants_default.DAY_OF_MONTH: return instanceFactorySet(1);
66
+ case constants_default.HOUR:
67
+ case constants_default.MIN:
68
+ case constants_default.SECOND:
69
+ case constants_default.MS: {
70
+ const step = {
71
+ minute: 60 * 1e3,
72
+ hour: 3600 * 1e3,
73
+ second: 1e3
74
+ }[unit] || 1;
75
+ const nextTimeStamp = $d.getTime() + value * step;
76
+ return createInstanceFromExist(new Date(nextTimeStamp), that);
77
+ }
78
+ default: return that.clone();
79
+ }
80
+ }
81
+ const utcPlugin = (_, dayClass, dayFactory) => {
82
+ dayFactory.utc = (d, ...others) => {
83
+ return dayFactory(d, ...others, { utc: true });
84
+ };
85
+ const proto = dayClass.prototype;
86
+ proto.utc = function(keepLocalTime) {
87
+ const inst = this.clone();
88
+ inst.$d = this.toDate();
89
+ inst["$conf"].utc = true;
90
+ if (keepLocalTime) return inst.add(this.utcOffset(), constants_default.MIN);
91
+ return inst;
92
+ };
93
+ proto.local = function() {
94
+ const inst = this.clone();
95
+ inst["$conf"].utc = false;
96
+ return inst;
97
+ };
98
+ proto.isUTC = function() {
99
+ return !!this["$conf"].utc;
100
+ };
101
+ proto.toISOString = function() {
102
+ if (this.isValid()) return this.toDate().toISOString();
103
+ return constants_default.INVALID_DATE_STRING;
104
+ };
105
+ proto.utcOffset = function(offset, keepLocalTime) {
106
+ if (offset === void 0) {
107
+ const defaultOffset = -Math.round(this.$d.getTimezoneOffset());
108
+ return utcOffsetGetImpl(this, defaultOffset);
109
+ }
110
+ return utcOffsetSetImpl(this, offset, keepLocalTime);
111
+ };
112
+ const oldValueOf = proto.valueOf;
113
+ proto.valueOf = function() {
114
+ if (this["$conf"].utcOffset !== void 0) {
115
+ const internalDate = this.$d;
116
+ const offsetToUse = Number(this["$conf"].localOffset ?? internalDate.getTimezoneOffset());
117
+ const addedOffset = Number(this["$conf"].utcOffset) + offsetToUse;
118
+ return internalDate.valueOf() - addedOffset * constants_default.MILLISECONDS_A_MINUTE;
119
+ }
120
+ return oldValueOf.call(this);
121
+ };
122
+ const oldFormat = proto.format;
123
+ proto.format = function(formatStr) {
124
+ const activeFormatString = formatStr || (this["$conf"].utc ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
125
+ return oldFormat.call(this, activeFormatString);
126
+ };
127
+ const oldDateFromDateComponents = proto["dateFromDateComponents"];
128
+ proto["dateFromDateComponents"] = function(Y, M, D, h, m, s, ms, offsetMs) {
129
+ if (!this["$conf"].utc) return oldDateFromDateComponents(Y, M, D, h, m, s, ms, offsetMs);
130
+ const parsedYearOrDefault = Y ?? (/* @__PURE__ */ new Date()).getFullYear();
131
+ const dateComponents = {
132
+ Y: parsedYearOrDefault,
133
+ M: (M ?? (Y !== void 0 ? 1 : (/* @__PURE__ */ new Date()).getMonth() + 1)) - 1,
134
+ D: D ?? 1,
135
+ h: h ?? 0,
136
+ m: m ?? 0,
137
+ s: s ?? 0,
138
+ ms: ms ?? 0
139
+ };
140
+ const yearWithoutCentury = Math.abs(parsedYearOrDefault) < 100;
141
+ let result;
142
+ let overflowed = false;
143
+ result = new Date(Date.UTC(dateComponents.Y, dateComponents.M, dateComponents.D, dateComponents.h, dateComponents.m, dateComponents.s, dateComponents.ms));
144
+ if (yearWithoutCentury) result.setUTCFullYear(dateComponents.Y);
145
+ overflowed = M !== void 0 && M - 1 !== result.getUTCMonth() || D !== void 0 && D !== result.getUTCDate() || h !== void 0 && h !== result.getUTCHours() || m !== void 0 && m !== result.getUTCMinutes() || s !== void 0 && s !== result.getUTCSeconds();
146
+ if (overflowed) result = constants_default.INVALID_DATE;
147
+ else if (!isUndefined(offsetMs)) result.setUTCMilliseconds(result.getUTCMilliseconds() - offsetMs);
148
+ return result;
149
+ };
150
+ const oldGet = proto.get;
151
+ proto.get = function(unit) {
152
+ const normalizedUnit = normalizeUnitWithPlurals(unit);
153
+ if (normalizedUnit === constants_default.QUARTER || normalizedUnit === constants_default.WEEK) return NaN;
154
+ if (this["$conf"].utc) return getUnitInDateUTC(this.$d, unit);
155
+ return oldGet.call(this, unit);
156
+ };
157
+ const old$set = proto["$set"];
158
+ proto["$set"] = function(unit, values) {
159
+ if (!!this["$conf"].utc) {
160
+ if (isObject(unit)) return this;
161
+ const $date = this.$d;
162
+ const normalizedUnit = normalizeUnitWithPlurals(unit);
163
+ if (normalizedUnit === constants_default.DAY) setUnitInDateUTC($date, constants_default.DAY_OF_MONTH, this.date() + (values[0] - this.day()));
164
+ else if (normalizedUnit === constants_default.YEAR && values.length === 2) {
165
+ const originalDate = this.date();
166
+ setUnitInDateUTC($date, constants_default.YEAR, values);
167
+ if (originalDate > 0 && this.date() !== originalDate) setUnitInDateUTC($date, constants_default.DAY_OF_MONTH, 0);
168
+ } else if (normalizedUnit === constants_default.MONTH) {
169
+ const originalDate = values.length === 1 ? this.date() : values[1];
170
+ setUnitInDateUTC($date, constants_default.MONTH, values);
171
+ if (originalDate > 0 && this.date() !== originalDate) setUnitInDateUTC($date, constants_default.DAY_OF_MONTH, 0);
172
+ } else if (normalizedUnit !== constants_default.QUARTER && normalizedUnit !== constants_default.WEEK) setUnitInDateUTC($date, normalizedUnit, values);
173
+ return this;
174
+ }
175
+ return old$set.call(this, unit, values);
176
+ };
177
+ const oldAdd = proto.add;
178
+ proto.add = function(value, unit) {
179
+ if (isObject(value) || unit === void 0) return oldAdd.call(this, value, unit);
180
+ if (this["$conf"].utc) return addUtc(this, value, unit);
181
+ return oldAdd.call(this, value, unit);
182
+ };
183
+ const oldSubtract = proto.subtract;
184
+ proto.subtract = function(value, unit) {
185
+ if (isObject(value) || unit === void 0) return oldSubtract.call(this, value, unit);
186
+ if (this["$conf"].utc) return addUtc(this, -value, unit);
187
+ return oldSubtract.call(this, value, unit);
188
+ };
189
+ };
190
+
191
+ //#endregion
192
+ export { utcPlugin as default };
@@ -0,0 +1,19 @@
1
+ import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
2
+
3
+ //#region src/plugins/week/index.d.ts
4
+ declare module 'esday' {
5
+ interface EsDay {
6
+ week(): number;
7
+ week(newWeek: number): EsDay;
8
+ weeks(): number;
9
+ weeks(newWeek: number): EsDay;
10
+ weekday(): number;
11
+ weekday(newWeekday: number): EsDay;
12
+ weekYear(): number;
13
+ weekYear(newWeekYear: number): EsDay;
14
+ weeksInYear(): number;
15
+ }
16
+ }
17
+ declare const weekPlugin: EsDayPlugin<{}>;
18
+ //#endregion
19
+ export { weekPlugin as default };
@@ -0,0 +1,350 @@
1
+ import { p as constants_default } from "../../chunks/BkjWOpMU.js";
2
+ import { a as isUndefined, r as isObject, t as isArray } from "../../chunks/v_QBn7Xm.js";
3
+ import { n as normalizeUnitWithPlurals } from "../../chunks/AyQQ6US-.js";
4
+ import { t as createInstanceFromExist } from "../../chunks/Shk32pTP.js";
5
+ import { n as padStart } from "../../chunks/CdvTtmWL.js";
6
+
7
+ //#region src/plugins/week/index.ts
8
+ const match1to2NoLeadingZero = /^[1-9]\d?/;
9
+ const match1 = /\d/;
10
+ const match2 = /\d\d/;
11
+ const match1to2 = /\d\d?/;
12
+ const match4 = /\d{4}/;
13
+ const match1to4 = /\d{1,4}/;
14
+ const matchWord = /\d*[^-_:/,()\s\d]+/;
15
+ /**
16
+ * Convert a number to an ordinal number, if a locale is available.
17
+ * Otherwise return value as string.
18
+ * @param sourceDate - date to take the locale from
19
+ * @param value - value to convert
20
+ * @returns value as ordinal
21
+ */
22
+ function toOrdinal(sourceDate, value) {
23
+ const defaultValue = value.toString();
24
+ return sourceDate.localeObject?.().ordinal?.(value) ?? defaultValue;
25
+ }
26
+ /**
27
+ * Create a function that will parse the input string as week, weekday or
28
+ * weekYear number and add it to the given 'parsedElements' containing the
29
+ * date&time components.
30
+ * @param property - name of the property to set
31
+ * @returns function that will add the given value to date&time component as new element
32
+ */
33
+ function addWeek(property) {
34
+ return function weekPropUpdater(parsedElements, input, _parseOptions) {
35
+ parsedElements[property] = +input;
36
+ };
37
+ }
38
+ /**
39
+ * Create a function that will convert the value from the input string
40
+ * to a day of week number and add it to the given 'parsedElements'
41
+ * containing the date&time components.
42
+ * @param property - name of the list of weekday names to use
43
+ * @returns function that will add the weekday value to date&time component
44
+ */
45
+ function addDayOfWeek(property, esday) {
46
+ return function weekdayUpdater(parsedElements, input, parseOptions) {
47
+ if (property === "day") parsedElements[property] = +input;
48
+ else {
49
+ const localeName = parseOptions["locale"];
50
+ const weekdays = esday.getLocale(localeName)[property];
51
+ let weekdayNames;
52
+ if (isArray(weekdays)) weekdayNames = weekdays;
53
+ else weekdayNames = weekdays.standalone;
54
+ parsedElements.day = weekdayNames.indexOf(input);
55
+ }
56
+ };
57
+ }
58
+ function parseTwoDigitYear(input) {
59
+ const year = +input.slice(0, 2);
60
+ return year + (year > 68 ? 1900 : 2e3);
61
+ }
62
+ /**
63
+ * Add parsed year as 2-digit value to parsedElements
64
+ * @param parsedElements - object containing the components of a parsed date
65
+ * @param input - parsed value (year)
66
+ * @param _options - parsing options e.g. containing the locale to use
67
+ */
68
+ function twoDigitsYearUpdater(parsedElements, input, _parseOptions) {
69
+ parsedElements["weekYear"] = parseTwoDigitYear(input);
70
+ }
71
+ const weekPlugin = (_, dayClass, dayFactory) => {
72
+ const proto = dayClass.prototype;
73
+ /**
74
+ * Set the week of the parsed date.
75
+ * Must be called in the context of an EsDay instance.
76
+ * @param this - context for this function (required for getting the $conf settings)
77
+ * @param parsedDate - Date object returned by parsing function
78
+ * @param parsedElements - object containing the components of a parsed date
79
+ * @returns parsedDate with week set to parsed value
80
+ */
81
+ function _postParseWeek(parsedDate, parsedElements) {
82
+ let modifiedDate = parsedDate;
83
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.week)) && isUndefined(parsedElements.date)) {
84
+ const newEsday = createInstanceFromExist(parsedDate, this);
85
+ const parsedWeek = parsedElements.week;
86
+ modifiedDate = newEsday.week(parsedWeek).weekday(0).toDate();
87
+ }
88
+ return modifiedDate;
89
+ }
90
+ /**
91
+ * Set the dayOfWeek of the parsed date.
92
+ * Must be called in the context of an EsDay instance.
93
+ * @param this - context for this function (required for getting the $conf settings)
94
+ * @param parsedDate - Date object returned by parsing function
95
+ * @param parsedElements - object containing the components of a parsed date
96
+ * @returns parsedDate or invalid date (if day of week does not match)
97
+ */
98
+ function _postParseWeekDay(parsedDate, parsedElements) {
99
+ const newWeekday = parsedElements.weekday;
100
+ if (!isUndefined(newWeekday) && newWeekday !== null && (newWeekday < 0 || newWeekday > 6)) return constants_default.INVALID_DATE;
101
+ let modifiedDate = parsedDate;
102
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(newWeekday)) && isUndefined(parsedElements.date)) {
103
+ let newEsday = dayFactory(parsedDate, { utc: this["$conf"].utc });
104
+ newEsday["$conf"] = structuredClone(this["$conf"]);
105
+ if (isUndefined(parsedElements.weekYear) && isUndefined(parsedElements.week)) {
106
+ const now = /* @__PURE__ */ new Date();
107
+ newEsday = newEsday.month(now.getMonth()).date(now.getDate());
108
+ }
109
+ modifiedDate = newEsday.weekday(newWeekday).toDate();
110
+ }
111
+ return modifiedDate;
112
+ }
113
+ /**
114
+ * Verify that parsed date is the expected day-of-week or set the day-of-week.
115
+ * Must be called in the context of an EsDay instance.
116
+ * @param this - context for this function (required for getting the $conf settings)
117
+ * @param parsedDate - Date object returned by parsing function
118
+ * @param parsedElements - object containing the components of a parsed date
119
+ * @returns parsedDate or invalid date (if day of week does not match)
120
+ */
121
+ function _postParseDayOfWeek(parsedDate, parsedElements) {
122
+ let modifiedDate = parsedDate;
123
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.day))) {
124
+ const now = createInstanceFromExist(/* @__PURE__ */ new Date(), this);
125
+ let newEsday = createInstanceFromExist(parsedDate, this);
126
+ if (parsedElements.year !== void 0 && parsedElements.month === void 0 && parsedElements.date === void 0) {
127
+ const currentWeek = now.week();
128
+ const dayOfWeek = (parsedElements.day + 7 - newEsday.localeObject().weekStart) % 7;
129
+ newEsday = newEsday.week(currentWeek).weekday(dayOfWeek);
130
+ modifiedDate = newEsday.toDate();
131
+ }
132
+ if (newEsday.day() !== parsedElements.day) modifiedDate = constants_default.INVALID_DATE;
133
+ }
134
+ return modifiedDate;
135
+ }
136
+ /**
137
+ * Set weekYear of parsed date.
138
+ * Must be called in the context of an EsDay instance.
139
+ * @param this - context for this function (required for getting the $conf settings)
140
+ * @param parsedDate - Date object returned by parsing function
141
+ * @param parsedElements - object containing the components of a parsed date
142
+ * @returns parsedDate with weekYear set to parsed value
143
+ */
144
+ function _postParseYear(parsedDate, parsedElements) {
145
+ let modifiedDate = parsedDate;
146
+ /* istanbul ignore else -- @preserve */
147
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.weekYear))) {
148
+ const newEsday = createInstanceFromExist(parsedDate, this);
149
+ const parsedWeekYear = parsedElements.weekYear;
150
+ if (Object.keys(parsedElements).length === 1) {
151
+ const now = /* @__PURE__ */ new Date();
152
+ let modifiedEsday = newEsday.weekYear(parsedWeekYear);
153
+ modifiedEsday = modifiedEsday.year(parsedWeekYear).month(now.getMonth()).date(now.getDate()).weekday(0);
154
+ modifiedDate = modifiedEsday.toDate();
155
+ } else if (!isUndefined(parsedElements.week)) modifiedDate = newEsday.weekYear(parsedWeekYear).toDate();
156
+ }
157
+ return modifiedDate;
158
+ }
159
+ proto.week = function(newWeek) {
160
+ if (newWeek !== void 0) {
161
+ const currentWeekday = this.weekday();
162
+ const h = this.hour();
163
+ const m = this.minute();
164
+ const s = this.second();
165
+ const ms = this.millisecond();
166
+ return this.add((newWeek - this.week()) * 7, constants_default.DAY).weekday(currentWeekday).hour(h, m, s, ms);
167
+ }
168
+ const yearStart = this.localeObject?.().yearStart || constants_default.INDEX_THURSDAY;
169
+ if (this.month() === 11 && this.date() > 25) {
170
+ const nextYearStartDay = this.startOf(constants_default.YEAR).add(1, constants_default.YEAR).date(yearStart);
171
+ const thisEndOfWeek = this.endOf(constants_default.WEEK);
172
+ if (nextYearStartDay.isBefore(thisEndOfWeek)) return 1;
173
+ }
174
+ const yearStartWeek = this.startOf(constants_default.YEAR).date(yearStart).startOf(constants_default.WEEK).subtract(1, constants_default.MS);
175
+ const diffInWeek = this.diff(yearStartWeek, constants_default.WEEK, true);
176
+ if (diffInWeek < 0) return this.startOf(constants_default.WEEK).week();
177
+ return Math.ceil(diffInWeek);
178
+ };
179
+ proto.weeks = proto.week;
180
+ /**
181
+ * Get or set the locale aware day of the week.
182
+ * 0 is always the first day of the week (according to locale.weekStart property),
183
+ * 6 is always the last day of the week.
184
+ * E.g. in Europe 0=Monday ... 6=Sunday.
185
+ * If no locale is loaded, Monday is used as start of week.
186
+ */
187
+ dayClass.prototype.weekday = function(newWeekday) {
188
+ const weekStart = this.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
189
+ const dow = this.day();
190
+ const weekday = (dow < weekStart ? dow + 7 : dow) - weekStart;
191
+ if (newWeekday !== void 0) return this.subtract(weekday, constants_default.DAY).add(newWeekday, constants_default.DAY);
192
+ return weekday;
193
+ };
194
+ /**
195
+ * Gets or sets the year of the week. This year may differ from
196
+ * the calendar year at the start or the end of a year (depending on
197
+ * 'yearStart').
198
+ * Setting the weekYear will keep the week number and the day of the week.
199
+ * If no locale is loaded, Monday is used as start of week.
200
+ */
201
+ proto.weekYear = function(newWeekYear) {
202
+ if (newWeekYear !== void 0) {
203
+ if (this.weekYear() === newWeekYear) return this;
204
+ const currentWeek = this.week();
205
+ const currentWeekday = this.weekday();
206
+ let newDate = this.year(newWeekYear).week(currentWeek).weekday(currentWeekday);
207
+ if (newDate.weekYear() !== newWeekYear) {
208
+ const yearDiff = newWeekYear - newDate.weekYear();
209
+ newDate = newDate.add(yearDiff, constants_default.YEAR).weekday(currentWeekday);
210
+ }
211
+ return newDate;
212
+ }
213
+ const month = this.month();
214
+ const weekOfYear = this.week();
215
+ const year = this.year();
216
+ if (weekOfYear === 1 && month === 11) return year + 1;
217
+ if (month === 0 && weekOfYear >= 52) return year - 1;
218
+ return year;
219
+ };
220
+ /**
221
+ * Get the number of weeks in the current year.
222
+ * Most years have 52 weeks, some have 53 weeks.
223
+ */
224
+ proto.weeksInYear = function() {
225
+ const weekStart = this.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
226
+ const yearStart = this.localeObject?.().yearStart ?? constants_default.INDEX_THURSDAY;
227
+ const preWeekStart = ((weekStart + 6) % 7 + 8 - yearStart) % 7;
228
+ const prePreWeekStart = (preWeekStart + 6) % 7;
229
+ const yearStartWeekday = this.month(0).date(1).day();
230
+ const year = this.year();
231
+ const isLeapYear = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
232
+ if (yearStartWeekday === preWeekStart || isLeapYear && yearStartWeekday === prePreWeekStart) return 53;
233
+ return 52;
234
+ };
235
+ const oldStartOf = proto.startOf;
236
+ proto.startOf = function(units) {
237
+ if (units === constants_default.WEEK) {
238
+ let newDate = this.clone();
239
+ const weekStart = newDate.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
240
+ const newDateWeekday = newDate.day();
241
+ const diff = (newDateWeekday < weekStart ? newDateWeekday + 7 : newDateWeekday) - weekStart;
242
+ const newDayOfMonth = newDate.date() - diff;
243
+ newDate = newDate.date(newDayOfMonth);
244
+ return newDate["$set"](constants_default.HOUR, [
245
+ 0,
246
+ 0,
247
+ 0,
248
+ 0
249
+ ]);
250
+ }
251
+ return oldStartOf.call(this, units);
252
+ };
253
+ const oldEndOf = proto.endOf;
254
+ proto.endOf = function(units) {
255
+ if (units === constants_default.WEEK) {
256
+ let newDate = this.clone();
257
+ const weekStart = newDate.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
258
+ const newDateWeekday = newDate.day();
259
+ const diff = (newDateWeekday < weekStart ? newDateWeekday + 7 : newDateWeekday) - weekStart;
260
+ const newDayOfMonth = newDate.date() + (6 - diff);
261
+ newDate = newDate.date(newDayOfMonth);
262
+ return newDate["$set"](constants_default.HOUR, [
263
+ 23,
264
+ 59,
265
+ 59,
266
+ 999
267
+ ]);
268
+ }
269
+ return oldEndOf.call(this, units);
270
+ };
271
+ const oldGet = proto.get;
272
+ proto.get = function(unit) {
273
+ if (normalizeUnitWithPlurals(unit) === constants_default.WEEK) return this.week();
274
+ return oldGet.call(this, unit);
275
+ };
276
+ const old$set = proto["$set"];
277
+ proto["$set"] = function(unit, values) {
278
+ if (isObject(unit)) return this;
279
+ if (normalizeUnitWithPlurals(unit) === constants_default.WEEK) return this.week(values[0]);
280
+ return old$set.call(this, unit, values);
281
+ };
282
+ dayFactory.addFormatTokenDefinitions({
283
+ w: (sourceDate) => sourceDate.week().toString(),
284
+ ww: (sourceDate) => padStart(sourceDate.week(), 2, "0"),
285
+ wo: (sourceDate) => toOrdinal(sourceDate, sourceDate.week()),
286
+ e: (sourceDate) => sourceDate.weekday().toString(),
287
+ gg: (sourceDate) => padStart(sourceDate.weekYear(), 2, "0").slice(-2),
288
+ gggg: (sourceDate) => padStart(sourceDate.weekYear(), 4, "0")
289
+ });
290
+ const parseTokensDefinitions = {
291
+ d: [
292
+ match1to2,
293
+ match1to2,
294
+ addDayOfWeek("day", dayFactory),
295
+ _postParseDayOfWeek
296
+ ],
297
+ dd: [
298
+ matchWord,
299
+ matchWord,
300
+ addDayOfWeek("weekdaysMin", dayFactory),
301
+ _postParseDayOfWeek
302
+ ],
303
+ ddd: [
304
+ matchWord,
305
+ matchWord,
306
+ addDayOfWeek("weekdaysShort", dayFactory),
307
+ _postParseDayOfWeek
308
+ ],
309
+ dddd: [
310
+ matchWord,
311
+ matchWord,
312
+ addDayOfWeek("weekdays", dayFactory),
313
+ _postParseDayOfWeek
314
+ ],
315
+ w: [
316
+ match1to2,
317
+ match1to2NoLeadingZero,
318
+ addWeek("week"),
319
+ _postParseWeek
320
+ ],
321
+ ww: [
322
+ match1to2,
323
+ match2,
324
+ addWeek("week"),
325
+ _postParseWeek
326
+ ],
327
+ e: [
328
+ match1to2,
329
+ match1,
330
+ addWeek("weekday"),
331
+ _postParseWeekDay
332
+ ],
333
+ gg: [
334
+ match1to4,
335
+ match2,
336
+ twoDigitsYearUpdater,
337
+ _postParseYear
338
+ ],
339
+ gggg: [
340
+ match1to4,
341
+ match4,
342
+ addWeek("weekYear"),
343
+ _postParseYear
344
+ ]
345
+ };
346
+ dayFactory.addParseTokenDefinitions?.(parseTokensDefinitions);
347
+ };
348
+
349
+ //#endregion
350
+ export { weekPlugin as default };