esday 0.5.0 → 0.6.3

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 (382) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +21 -21
  3. package/README.md +63 -51
  4. package/chunks/AyQQ6US-.js +84 -0
  5. package/chunks/{Y32qdU_5.js → BkjWOpMU.js} +7 -1
  6. package/chunks/{MtjcOKi-.d.ts → C5qDMHT5.d.ts} +2 -2
  7. package/chunks/{DqhiVwLi.d.ts → CODi8AFH.d.ts} +63 -35
  8. package/chunks/CXWzCl3n.js +481 -0
  9. package/chunks/{BRRrAbUl.js → CdvTtmWL.js} +2 -2
  10. package/chunks/{DXHbH1CI.js → Shk32pTP.js} +1 -1
  11. package/chunks/{Cb5SvF6r.js → v_QBn7Xm.js} +1 -1
  12. package/chunks/xt8C2lbv.js +38 -0
  13. package/index.d.ts +3 -3
  14. package/index.js +1 -571
  15. package/locales/af.d.ts +1 -3
  16. package/locales/af.js +4 -2
  17. package/locales/am.d.ts +1 -3
  18. package/locales/am.js +4 -2
  19. package/locales/ar-dz.d.ts +1 -3
  20. package/locales/ar-dz.js +7 -9
  21. package/locales/ar-iq.d.ts +1 -3
  22. package/locales/ar-iq.js +7 -9
  23. package/locales/ar-kw.d.ts +1 -3
  24. package/locales/ar-kw.js +7 -9
  25. package/locales/ar-ly.d.ts +1 -3
  26. package/locales/ar-ly.js +7 -9
  27. package/locales/ar-ma.d.ts +1 -3
  28. package/locales/ar-ma.js +7 -9
  29. package/locales/ar-sa.d.ts +1 -3
  30. package/locales/ar-sa.js +7 -9
  31. package/locales/ar-tn.d.ts +1 -3
  32. package/locales/ar-tn.js +7 -9
  33. package/locales/ar.d.ts +1 -3
  34. package/locales/ar.js +197 -2
  35. package/locales/az.d.ts +1 -3
  36. package/locales/az.js +4 -2
  37. package/locales/be.d.ts +1 -3
  38. package/locales/be.js +55 -59
  39. package/locales/bg.d.ts +1 -3
  40. package/locales/bg.js +4 -2
  41. package/locales/bi.d.ts +1 -3
  42. package/locales/bi.js +4 -2
  43. package/locales/bm.d.ts +1 -3
  44. package/locales/bm.js +4 -2
  45. package/locales/bn-bd.d.ts +1 -3
  46. package/locales/bn-bd.js +7 -9
  47. package/locales/bn.d.ts +1 -3
  48. package/locales/bn.js +136 -2
  49. package/locales/bo.d.ts +1 -3
  50. package/locales/bo.js +4 -2
  51. package/locales/br.d.ts +1 -3
  52. package/locales/br.js +10 -9
  53. package/locales/bs.d.ts +1 -3
  54. package/locales/bs.js +4 -2
  55. package/locales/ca.d.ts +1 -3
  56. package/locales/ca.js +35 -36
  57. package/locales/cs.d.ts +1 -3
  58. package/locales/cs.js +38 -34
  59. package/locales/cv.d.ts +1 -3
  60. package/locales/cv.js +4 -2
  61. package/locales/cy.d.ts +1 -3
  62. package/locales/cy.js +4 -2
  63. package/locales/da.d.ts +1 -3
  64. package/locales/da.js +4 -2
  65. package/locales/de-at.d.ts +1 -3
  66. package/locales/de-at.js +7 -9
  67. package/locales/de-ch.d.ts +1 -3
  68. package/locales/de-ch.js +7 -9
  69. package/locales/de.d.ts +1 -3
  70. package/locales/de.js +130 -2
  71. package/locales/dv.d.ts +1 -3
  72. package/locales/dv.js +4 -2
  73. package/locales/el.d.ts +1 -3
  74. package/locales/el.js +4 -2
  75. package/locales/en-au.d.ts +1 -3
  76. package/locales/en-au.js +7 -8
  77. package/locales/en-ca.d.ts +1 -3
  78. package/locales/en-ca.js +7 -8
  79. package/locales/en-gb.d.ts +1 -3
  80. package/locales/en-gb.js +9 -8
  81. package/locales/en-ie.d.ts +1 -3
  82. package/locales/en-ie.js +7 -8
  83. package/locales/en-il.d.ts +1 -3
  84. package/locales/en-il.js +7 -8
  85. package/locales/en-in.d.ts +1 -3
  86. package/locales/en-in.js +7 -8
  87. package/locales/en-nz.d.ts +1 -3
  88. package/locales/en-nz.js +7 -8
  89. package/locales/en-sg.d.ts +1 -3
  90. package/locales/en-sg.js +7 -8
  91. package/locales/en-tt.d.ts +1 -3
  92. package/locales/en-tt.js +7 -8
  93. package/locales/en-us.d.ts +1 -3
  94. package/locales/en-us.js +7 -8
  95. package/locales/en.d.ts +1 -3
  96. package/locales/en.js +116 -2
  97. package/locales/eo.d.ts +1 -3
  98. package/locales/eo.js +4 -2
  99. package/locales/es-do.d.ts +1 -3
  100. package/locales/es-do.js +7 -9
  101. package/locales/es-mx.d.ts +1 -3
  102. package/locales/es-mx.js +7 -9
  103. package/locales/es-pr.d.ts +1 -3
  104. package/locales/es-pr.js +7 -9
  105. package/locales/es-us.d.ts +1 -3
  106. package/locales/es-us.js +7 -9
  107. package/locales/es.d.ts +1 -3
  108. package/locales/es.js +117 -2
  109. package/locales/et.d.ts +1 -3
  110. package/locales/et.js +6 -2
  111. package/locales/eu.d.ts +1 -3
  112. package/locales/eu.js +4 -2
  113. package/locales/fa.d.ts +1 -3
  114. package/locales/fa.js +4 -2
  115. package/locales/fi.d.ts +1 -3
  116. package/locales/fi.js +8 -2
  117. package/locales/fil.d.ts +1 -3
  118. package/locales/fil.js +4 -2
  119. package/locales/fo.d.ts +1 -3
  120. package/locales/fo.js +4 -2
  121. package/locales/fr-ca.d.ts +1 -3
  122. package/locales/fr-ca.js +7 -9
  123. package/locales/fr-ch.d.ts +1 -3
  124. package/locales/fr-ch.js +7 -9
  125. package/locales/fr.d.ts +1 -3
  126. package/locales/fr.js +109 -2
  127. package/locales/fy.d.ts +1 -3
  128. package/locales/fy.js +4 -2
  129. package/locales/ga.d.ts +1 -3
  130. package/locales/ga.js +4 -2
  131. package/locales/gd.d.ts +1 -3
  132. package/locales/gd.js +4 -2
  133. package/locales/gl.d.ts +1 -3
  134. package/locales/gl.js +4 -2
  135. package/locales/gom-deva.d.ts +1 -3
  136. package/locales/gom-deva.js +34 -32
  137. package/locales/gom-latn.d.ts +1 -3
  138. package/locales/gom-latn.js +34 -32
  139. package/locales/gu.d.ts +1 -3
  140. package/locales/gu.js +4 -2
  141. package/locales/he.d.ts +1 -3
  142. package/locales/he.js +8 -5
  143. package/locales/hi.d.ts +1 -3
  144. package/locales/hi.js +34 -35
  145. package/locales/hr.d.ts +1 -3
  146. package/locales/hr.js +10 -4
  147. package/locales/ht.d.ts +1 -3
  148. package/locales/ht.js +4 -2
  149. package/locales/hu.d.ts +1 -3
  150. package/locales/hu.js +6 -2
  151. package/locales/hy-am.d.ts +1 -3
  152. package/locales/hy-am.js +34 -35
  153. package/locales/id.d.ts +1 -3
  154. package/locales/id.js +4 -2
  155. package/locales/is.d.ts +1 -3
  156. package/locales/is.js +14 -2
  157. package/locales/it-ch.d.ts +1 -3
  158. package/locales/it-ch.js +4 -9
  159. package/locales/it.d.ts +1 -3
  160. package/locales/it.js +120 -2
  161. package/locales/ja.d.ts +1 -4
  162. package/locales/ja.js +4 -2
  163. package/locales/jv.d.ts +1 -3
  164. package/locales/jv.js +4 -2
  165. package/locales/ka.d.ts +1 -3
  166. package/locales/ka.js +25 -26
  167. package/locales/kk.d.ts +1 -3
  168. package/locales/kk.js +4 -2
  169. package/locales/km.d.ts +1 -3
  170. package/locales/km.js +4 -2
  171. package/locales/kn.d.ts +1 -3
  172. package/locales/kn.js +4 -2
  173. package/locales/ko.d.ts +1 -3
  174. package/locales/ko.js +5 -3
  175. package/locales/ku.d.ts +1 -3
  176. package/locales/ku.js +4 -2
  177. package/locales/ky.d.ts +1 -3
  178. package/locales/ky.js +4 -2
  179. package/locales/lb.d.ts +1 -3
  180. package/locales/lb.js +5 -2
  181. package/locales/lo.d.ts +1 -3
  182. package/locales/lo.js +4 -2
  183. package/locales/lt.d.ts +1 -3
  184. package/locales/lt.js +4 -2
  185. package/locales/lv.d.ts +1 -3
  186. package/locales/lv.js +4 -2
  187. package/locales/me.d.ts +1 -3
  188. package/locales/me.js +33 -33
  189. package/locales/mi.d.ts +1 -3
  190. package/locales/mi.js +4 -2
  191. package/locales/mk.d.ts +1 -3
  192. package/locales/mk.js +4 -2
  193. package/locales/ml.d.ts +1 -3
  194. package/locales/ml.js +4 -2
  195. package/locales/mn.d.ts +1 -3
  196. package/locales/mn.js +37 -16
  197. package/locales/mr.d.ts +1 -3
  198. package/locales/mr.js +16 -2
  199. package/locales/ms-my.d.ts +1 -3
  200. package/locales/ms-my.js +7 -9
  201. package/locales/ms.d.ts +1 -3
  202. package/locales/ms.js +107 -2
  203. package/locales/mt.d.ts +1 -3
  204. package/locales/mt.js +4 -2
  205. package/locales/my.d.ts +1 -3
  206. package/locales/my.js +4 -2
  207. package/locales/nb.d.ts +1 -3
  208. package/locales/nb.js +4 -2
  209. package/locales/ne.d.ts +1 -3
  210. package/locales/ne.js +4 -2
  211. package/locales/nl-be.d.ts +1 -3
  212. package/locales/nl-be.js +7 -9
  213. package/locales/nl.d.ts +1 -3
  214. package/locales/nl.js +107 -2
  215. package/locales/nn.d.ts +1 -3
  216. package/locales/nn.js +4 -2
  217. package/locales/oc-lnc.d.ts +1 -3
  218. package/locales/oc-lnc.js +35 -36
  219. package/locales/pa-in.d.ts +1 -3
  220. package/locales/pa-in.js +4 -2
  221. package/locales/pl.d.ts +1 -3
  222. package/locales/pl.js +5 -2
  223. package/locales/pt-br.d.ts +1 -3
  224. package/locales/pt-br.js +7 -9
  225. package/locales/pt.d.ts +1 -3
  226. package/locales/pt.js +109 -2
  227. package/locales/rn.d.ts +1 -3
  228. package/locales/rn.js +4 -2
  229. package/locales/ro.d.ts +1 -3
  230. package/locales/ro.js +4 -2
  231. package/locales/ru.d.ts +1 -4
  232. package/locales/ru.js +83 -82
  233. package/locales/rw.d.ts +1 -3
  234. package/locales/rw.js +4 -2
  235. package/locales/sd.d.ts +1 -3
  236. package/locales/sd.js +4 -2
  237. package/locales/se.d.ts +1 -3
  238. package/locales/se.js +4 -2
  239. package/locales/si.d.ts +1 -3
  240. package/locales/si.js +4 -2
  241. package/locales/sk.d.ts +1 -3
  242. package/locales/sk.js +8 -2
  243. package/locales/sl.d.ts +1 -3
  244. package/locales/sl.js +8 -2
  245. package/locales/sq.d.ts +1 -3
  246. package/locales/sq.js +4 -2
  247. package/locales/sr-cyrl.d.ts +1 -3
  248. package/locales/sr-cyrl.js +16 -15
  249. package/locales/sr.d.ts +1 -3
  250. package/locales/sr.js +185 -2
  251. package/locales/ss.d.ts +1 -3
  252. package/locales/ss.js +4 -2
  253. package/locales/sv-fi.d.ts +1 -3
  254. package/locales/sv-fi.js +7 -9
  255. package/locales/sv.d.ts +1 -3
  256. package/locales/sv.js +110 -2
  257. package/locales/sw.d.ts +1 -3
  258. package/locales/sw.js +4 -2
  259. package/locales/ta.d.ts +1 -3
  260. package/locales/ta.js +4 -2
  261. package/locales/te.d.ts +1 -3
  262. package/locales/te.js +4 -2
  263. package/locales/tet.d.ts +1 -3
  264. package/locales/tet.js +5 -4
  265. package/locales/tg.d.ts +1 -3
  266. package/locales/tg.js +34 -35
  267. package/locales/th.d.ts +1 -3
  268. package/locales/th.js +4 -2
  269. package/locales/tk.d.ts +1 -3
  270. package/locales/tk.js +5 -4
  271. package/locales/tl-ph.d.ts +1 -3
  272. package/locales/tl-ph.js +4 -2
  273. package/locales/tlh.d.ts +1 -3
  274. package/locales/tlh.js +5 -2
  275. package/locales/tr.d.ts +1 -3
  276. package/locales/tr.js +5 -4
  277. package/locales/tzl.d.ts +1 -3
  278. package/locales/tzl.js +4 -2
  279. package/locales/tzm-latn.d.ts +1 -3
  280. package/locales/tzm-latn.js +9 -9
  281. package/locales/tzm.d.ts +1 -3
  282. package/locales/tzm.js +107 -2
  283. package/locales/ug-cn.d.ts +1 -3
  284. package/locales/ug-cn.js +4 -2
  285. package/locales/uk.d.ts +1 -3
  286. package/locales/uk.js +37 -32
  287. package/locales/ur.d.ts +1 -3
  288. package/locales/ur.js +4 -2
  289. package/locales/uz-latn.d.ts +1 -3
  290. package/locales/uz-latn.js +9 -9
  291. package/locales/uz.d.ts +1 -3
  292. package/locales/uz.js +107 -2
  293. package/locales/vi.d.ts +1 -3
  294. package/locales/vi.js +4 -2
  295. package/locales/x-pseudo.d.ts +1 -3
  296. package/locales/x-pseudo.js +5 -4
  297. package/locales/yo.d.ts +1 -3
  298. package/locales/yo.js +4 -2
  299. package/locales/zh-cn.d.ts +1 -3
  300. package/locales/zh-cn.js +7 -9
  301. package/locales/zh-hk.d.ts +1 -3
  302. package/locales/zh-hk.js +7 -9
  303. package/locales/zh-mo.d.ts +1 -3
  304. package/locales/zh-mo.js +7 -9
  305. package/locales/zh-tw.d.ts +1 -3
  306. package/locales/zh-tw.js +7 -9
  307. package/locales/zh.d.ts +1 -4
  308. package/locales/zh.js +128 -2
  309. package/package.json +29 -23
  310. package/plugins/advancedFormat/index.d.ts +1 -3
  311. package/plugins/advancedFormat/index.js +4 -6
  312. package/plugins/advancedParse/index.d.ts +1 -3
  313. package/plugins/advancedParse/index.js +21 -20
  314. package/plugins/calendar/index.d.ts +2 -4
  315. package/plugins/calendar/index.js +1 -2
  316. package/plugins/dayOfYear/index.d.ts +1 -2
  317. package/plugins/dayOfYear/index.js +1 -2
  318. package/plugins/duration/index.d.ts +78 -0
  319. package/plugins/duration/index.js +477 -0
  320. package/plugins/isBetween/index.d.ts +1 -2
  321. package/plugins/isBetween/index.js +2 -3
  322. package/plugins/isLeapYear/index.d.ts +1 -2
  323. package/plugins/isLeapYear/index.js +1 -2
  324. package/plugins/isSameOrAfter/index.d.ts +1 -2
  325. package/plugins/isSameOrAfter/index.js +1 -2
  326. package/plugins/isSameOrBefore/index.d.ts +1 -2
  327. package/plugins/isSameOrBefore/index.js +1 -2
  328. package/plugins/isToday/index.d.ts +1 -2
  329. package/plugins/isToday/index.js +2 -3
  330. package/plugins/isTomorrow/index.d.ts +1 -2
  331. package/plugins/isTomorrow/index.js +2 -3
  332. package/plugins/isYesterday/index.d.ts +1 -2
  333. package/plugins/isYesterday/index.js +2 -3
  334. package/plugins/isoWeek/index.d.ts +1 -3
  335. package/plugins/isoWeek/index.js +13 -25
  336. package/plugins/locale/index.d.ts +103 -3
  337. package/plugins/locale/index.js +140 -6
  338. package/plugins/localeData/index.d.ts +1 -3
  339. package/plugins/localeData/index.js +18 -11
  340. package/plugins/localizedFormat/index.d.ts +1 -3
  341. package/plugins/localizedFormat/index.js +5 -10
  342. package/plugins/localizedParse/index.d.ts +1 -3
  343. package/plugins/localizedParse/index.js +40 -22
  344. package/plugins/minMax/index.d.ts +1 -2
  345. package/plugins/minMax/index.js +2 -3
  346. package/plugins/objectSupport/index.d.ts +1 -3
  347. package/plugins/objectSupport/index.js +33 -38
  348. package/plugins/pluralGetSet/index.d.ts +1 -3
  349. package/plugins/pluralGetSet/index.js +1 -2
  350. package/plugins/quarterOfYear/index.d.ts +1 -3
  351. package/plugins/quarterOfYear/index.js +11 -18
  352. package/plugins/relativeTime/index.d.ts +32 -44
  353. package/plugins/relativeTime/index.js +124 -91
  354. package/plugins/timezone/index.d.ts +6 -0
  355. package/plugins/timezone/index.js +456 -0
  356. package/plugins/toArray/index.d.ts +1 -2
  357. package/plugins/toArray/index.js +1 -2
  358. package/plugins/toObject/index.d.ts +1 -2
  359. package/plugins/toObject/index.js +1 -2
  360. package/plugins/utc/index.d.ts +1 -2
  361. package/plugins/utc/index.js +37 -39
  362. package/plugins/week/index.d.ts +1 -3
  363. package/plugins/week/index.js +17 -27
  364. package/chunks/B5f9poqo.js +0 -120
  365. package/chunks/BDssPbM_.js +0 -106
  366. package/chunks/BXRGSAJG.js +0 -128
  367. package/chunks/BeVgU2nj.js +0 -188
  368. package/chunks/BtmEtAW3.js +0 -43
  369. package/chunks/CQ57zhVp.js +0 -106
  370. package/chunks/CQJ0-ZuR.js +0 -106
  371. package/chunks/CWqzr5E5.js +0 -108
  372. package/chunks/Cg4ZI9v8.js +0 -180
  373. package/chunks/CoBtJ4c1.js +0 -144
  374. package/chunks/D009Z-ld.js +0 -109
  375. package/chunks/DMtTiWuY.js +0 -127
  376. package/chunks/Dixb5KKs.js +0 -116
  377. package/chunks/DjY7KvwG.js +0 -28
  378. package/chunks/GjKpN6U-.js +0 -135
  379. package/chunks/St35qgL0.d.ts +0 -103
  380. package/chunks/br7kModF.js +0 -110
  381. package/chunks/l2Rxo2H0.js +0 -106
  382. package/chunks/tfkJ5D3p.js +0 -115
@@ -1,8 +1,6 @@
1
- import { EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
- import "../../chunks/MtjcOKi-.js";
1
+ import { o as EsDayPlugin } from "../../chunks/CODi8AFH.js";
3
2
 
4
3
  //#region src/plugins/week/index.d.ts
5
-
6
4
  declare module 'esday' {
7
5
  interface EsDay {
8
6
  week(): number;
@@ -1,8 +1,8 @@
1
- import { constants_default } from "../../chunks/Y32qdU_5.js";
2
- import { isArray, isObject, isUndefined } from "../../chunks/Cb5SvF6r.js";
3
- import { normalizeUnitWithPlurals } from "../../chunks/DjY7KvwG.js";
4
- import { createInstanceFromExist } from "../../chunks/DXHbH1CI.js";
5
- import { padStart } from "../../chunks/BRRrAbUl.js";
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
6
 
7
7
  //#region src/plugins/week/index.ts
8
8
  const match1to2NoLeadingZero = /^[1-9]\d?/;
@@ -56,8 +56,7 @@ function addDayOfWeek(property, esday) {
56
56
  };
57
57
  }
58
58
  function parseTwoDigitYear(input) {
59
- const inputLimited = input.slice(0, 2);
60
- const year = +inputLimited;
59
+ const year = +input.slice(0, 2);
61
60
  return year + (year > 68 ? 1900 : 2e3);
62
61
  }
63
62
  /**
@@ -84,8 +83,7 @@ const weekPlugin = (_, dayClass, dayFactory) => {
84
83
  if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.week)) && isUndefined(parsedElements.date)) {
85
84
  const newEsday = createInstanceFromExist(parsedDate, this);
86
85
  const parsedWeek = parsedElements.week;
87
- const modifiedEsday = newEsday.week(parsedWeek).weekday(0);
88
- modifiedDate = modifiedEsday.toDate();
86
+ modifiedDate = newEsday.week(parsedWeek).weekday(0).toDate();
89
87
  }
90
88
  return modifiedDate;
91
89
  }
@@ -108,8 +106,7 @@ const weekPlugin = (_, dayClass, dayFactory) => {
108
106
  const now = /* @__PURE__ */ new Date();
109
107
  newEsday = newEsday.month(now.getMonth()).date(now.getDate());
110
108
  }
111
- const modifiedEsday = newEsday.weekday(newWeekday);
112
- modifiedDate = modifiedEsday.toDate();
109
+ modifiedDate = newEsday.weekday(newWeekday).toDate();
113
110
  }
114
111
  return modifiedDate;
115
112
  }
@@ -146,6 +143,7 @@ const weekPlugin = (_, dayClass, dayFactory) => {
146
143
  */
147
144
  function _postParseYear(parsedDate, parsedElements) {
148
145
  let modifiedDate = parsedDate;
146
+ /* istanbul ignore else -- @preserve */
149
147
  if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.weekYear))) {
150
148
  const newEsday = createInstanceFromExist(parsedDate, this);
151
149
  const parsedWeekYear = parsedElements.weekYear;
@@ -154,10 +152,7 @@ const weekPlugin = (_, dayClass, dayFactory) => {
154
152
  let modifiedEsday = newEsday.weekYear(parsedWeekYear);
155
153
  modifiedEsday = modifiedEsday.year(parsedWeekYear).month(now.getMonth()).date(now.getDate()).weekday(0);
156
154
  modifiedDate = modifiedEsday.toDate();
157
- } else if (!isUndefined(parsedElements.week)) {
158
- const modifiedEsday = newEsday.weekYear(parsedWeekYear);
159
- modifiedDate = modifiedEsday.toDate();
160
- }
155
+ } else if (!isUndefined(parsedElements.week)) modifiedDate = newEsday.weekYear(parsedWeekYear).toDate();
161
156
  }
162
157
  return modifiedDate;
163
158
  }
@@ -176,8 +171,7 @@ const weekPlugin = (_, dayClass, dayFactory) => {
176
171
  const thisEndOfWeek = this.endOf(constants_default.WEEK);
177
172
  if (nextYearStartDay.isBefore(thisEndOfWeek)) return 1;
178
173
  }
179
- const yearStartDay = this.startOf(constants_default.YEAR).date(yearStart);
180
- const yearStartWeek = yearStartDay.startOf(constants_default.WEEK).subtract(1, constants_default.MS);
174
+ const yearStartWeek = this.startOf(constants_default.YEAR).date(yearStart).startOf(constants_default.WEEK).subtract(1, constants_default.MS);
181
175
  const diffInWeek = this.diff(yearStartWeek, constants_default.WEEK, true);
182
176
  if (diffInWeek < 0) return this.startOf(constants_default.WEEK).week();
183
177
  return Math.ceil(diffInWeek);
@@ -276,26 +270,23 @@ const weekPlugin = (_, dayClass, dayFactory) => {
276
270
  };
277
271
  const oldGet = proto.get;
278
272
  proto.get = function(unit) {
279
- const normalizedUnit = normalizeUnitWithPlurals(unit);
280
- if (normalizedUnit === constants_default.WEEK) return this.week();
273
+ if (normalizeUnitWithPlurals(unit) === constants_default.WEEK) return this.week();
281
274
  return oldGet.call(this, unit);
282
275
  };
283
276
  const old$set = proto["$set"];
284
277
  proto["$set"] = function(unit, values) {
285
- if (isObject(unit)) return this.clone();
286
- const normalizedUnit = normalizeUnitWithPlurals(unit);
287
- if (normalizedUnit === constants_default.WEEK) return this.week(values[0]);
278
+ if (isObject(unit)) return this;
279
+ if (normalizeUnitWithPlurals(unit) === constants_default.WEEK) return this.week(values[0]);
288
280
  return old$set.call(this, unit, values);
289
281
  };
290
- const additionalTokens = {
282
+ dayFactory.addFormatTokenDefinitions({
291
283
  w: (sourceDate) => sourceDate.week().toString(),
292
284
  ww: (sourceDate) => padStart(sourceDate.week(), 2, "0"),
293
285
  wo: (sourceDate) => toOrdinal(sourceDate, sourceDate.week()),
294
286
  e: (sourceDate) => sourceDate.weekday().toString(),
295
287
  gg: (sourceDate) => padStart(sourceDate.weekYear(), 2, "0").slice(-2),
296
288
  gggg: (sourceDate) => padStart(sourceDate.weekYear(), 4, "0")
297
- };
298
- dayFactory.addFormatTokenDefinitions(additionalTokens);
289
+ });
299
290
  const parseTokensDefinitions = {
300
291
  d: [
301
292
  match1to2,
@@ -354,7 +345,6 @@ const weekPlugin = (_, dayClass, dayFactory) => {
354
345
  };
355
346
  dayFactory.addParseTokenDefinitions?.(parseTokensDefinitions);
356
347
  };
357
- var week_default = weekPlugin;
358
348
 
359
349
  //#endregion
360
- export { week_default as default };
350
+ export { weekPlugin as default };
@@ -1,120 +0,0 @@
1
- //#region src/locales/it.ts
2
- const calendar = {
3
- sameDay() {
4
- return `[Oggi a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
5
- },
6
- nextDay() {
7
- return `[Domani a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
8
- },
9
- nextWeek() {
10
- return `dddd [a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
11
- },
12
- lastDay() {
13
- return `[Ieri a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
14
- },
15
- lastWeek() {
16
- switch (this.day()) {
17
- case 0: return `[La scorsa] dddd [a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
18
- default: return `[Lo scorso] dddd [a${this.hour() > 1 ? "lle " : this.hour() === 0 ? " " : "ll'"}]LT`;
19
- }
20
- },
21
- sameElse: "L"
22
- };
23
- const localeIt = {
24
- name: "it",
25
- weekdays: [
26
- "domenica",
27
- "lunedì",
28
- "martedì",
29
- "mercoledì",
30
- "giovedì",
31
- "venerdì",
32
- "sabato"
33
- ],
34
- weekdaysShort: [
35
- "dom",
36
- "lun",
37
- "mar",
38
- "mer",
39
- "gio",
40
- "ven",
41
- "sab"
42
- ],
43
- weekdaysMin: [
44
- "do",
45
- "lu",
46
- "ma",
47
- "me",
48
- "gi",
49
- "ve",
50
- "sa"
51
- ],
52
- months: [
53
- "gennaio",
54
- "febbraio",
55
- "marzo",
56
- "aprile",
57
- "maggio",
58
- "giugno",
59
- "luglio",
60
- "agosto",
61
- "settembre",
62
- "ottobre",
63
- "novembre",
64
- "dicembre"
65
- ],
66
- monthsShort: [
67
- "gen",
68
- "feb",
69
- "mar",
70
- "apr",
71
- "mag",
72
- "giu",
73
- "lug",
74
- "ago",
75
- "set",
76
- "ott",
77
- "nov",
78
- "dic"
79
- ],
80
- ordinal: (n) => `${n}º`,
81
- weekStart: 1,
82
- yearStart: 4,
83
- formats: {
84
- LT: "HH:mm",
85
- LTS: "HH:mm:ss",
86
- L: "DD/MM/YYYY",
87
- LL: "D MMMM YYYY",
88
- LLL: "D MMMM YYYY HH:mm",
89
- LLLL: "dddd D MMMM YYYY HH:mm",
90
- l: "DD/MM/YYYY",
91
- ll: "D MMMM YYYY",
92
- lll: "D MMMM YYYY HH:mm",
93
- llll: "dddd D MMMM YYYY HH:mm"
94
- },
95
- calendar,
96
- relativeTime: {
97
- future: "tra %s",
98
- past: "%s fa",
99
- s: "qualche secondo",
100
- ss: "%d secondi",
101
- m: "un minuto",
102
- mm: "%d minuti",
103
- h: "un' ora",
104
- hh: "%d ore",
105
- d: "un giorno",
106
- dd: "%d giorni",
107
- M: "un mese",
108
- MM: "%d mesi",
109
- y: "un anno",
110
- yy: "%d anni"
111
- },
112
- meridiem: (hour, _minute, isLowercase) => {
113
- const m = hour < 12 ? "AM" : "PM";
114
- return isLowercase ? m.toLowerCase() : m;
115
- }
116
- };
117
- var it_default = localeIt;
118
-
119
- //#endregion
120
- export { it_default };
@@ -1,106 +0,0 @@
1
- //#region src/locales/nl.ts
2
- const localeNl = {
3
- name: "nl",
4
- weekdays: [
5
- "zondag",
6
- "maandag",
7
- "dinsdag",
8
- "woensdag",
9
- "donderdag",
10
- "vrijdag",
11
- "zaterdag"
12
- ],
13
- weekdaysShort: [
14
- "zo.",
15
- "ma.",
16
- "di.",
17
- "wo.",
18
- "do.",
19
- "vr.",
20
- "za."
21
- ],
22
- weekdaysMin: [
23
- "zo",
24
- "ma",
25
- "di",
26
- "wo",
27
- "do",
28
- "vr",
29
- "za"
30
- ],
31
- months: [
32
- "januari",
33
- "februari",
34
- "maart",
35
- "april",
36
- "mei",
37
- "juni",
38
- "juli",
39
- "augustus",
40
- "september",
41
- "oktober",
42
- "november",
43
- "december"
44
- ],
45
- monthsShort: [
46
- "jan",
47
- "feb",
48
- "mrt",
49
- "apr",
50
- "mei",
51
- "jun",
52
- "jul",
53
- "aug",
54
- "sep",
55
- "okt",
56
- "nov",
57
- "dec"
58
- ],
59
- ordinal: (n) => `[${n}${n === 1 || n === 8 || n >= 20 ? "ste" : "de"}]`,
60
- weekStart: 1,
61
- yearStart: 4,
62
- formats: {
63
- LT: "HH:mm",
64
- LTS: "HH:mm:ss",
65
- L: "DD-MM-YYYY",
66
- LL: "D MMMM YYYY",
67
- LLL: "D MMMM YYYY HH:mm",
68
- LLLL: "dddd D MMMM YYYY HH:mm",
69
- l: "DD-MM-YYYY",
70
- ll: "D MMMM YYYY",
71
- lll: "D MMMM YYYY HH:mm",
72
- llll: "dddd D MMMM YYYY HH:mm"
73
- },
74
- calendar: {
75
- sameDay: "[vandaag om] LT",
76
- nextDay: "[morgen om] LT",
77
- nextWeek: "dddd [om] LT",
78
- lastDay: "[gisteren om] LT",
79
- lastWeek: "[afgelopen] dddd [om] LT",
80
- sameElse: "L"
81
- },
82
- relativeTime: {
83
- future: "over %s",
84
- past: "%s geleden",
85
- s: "een paar seconden",
86
- ss: "%d seconden",
87
- m: "een minuut",
88
- mm: "%d minuten",
89
- h: "een uur",
90
- hh: "%d uur",
91
- d: "een dag",
92
- dd: "%d dagen",
93
- M: "een maand",
94
- MM: "%d maanden",
95
- y: "een jaar",
96
- yy: "%d jaar"
97
- },
98
- meridiem: (hour, _minute, isLowercase) => {
99
- const m = hour < 12 ? "AM" : "PM";
100
- return isLowercase ? m.toLowerCase() : m;
101
- }
102
- };
103
- var nl_default = localeNl;
104
-
105
- //#endregion
106
- export { nl_default };
@@ -1,128 +0,0 @@
1
- //#region src/locales/zh.ts
2
- const localeZh = {
3
- name: "zh",
4
- weekdays: [
5
- "星期日",
6
- "星期一",
7
- "星期二",
8
- "星期三",
9
- "星期四",
10
- "星期五",
11
- "星期六"
12
- ],
13
- weekdaysShort: [
14
- "周日",
15
- "周一",
16
- "周二",
17
- "周三",
18
- "周四",
19
- "周五",
20
- "周六"
21
- ],
22
- weekdaysMin: [
23
- "日",
24
- "一",
25
- "二",
26
- "三",
27
- "四",
28
- "五",
29
- "六"
30
- ],
31
- months: [
32
- "一月",
33
- "二月",
34
- "三月",
35
- "四月",
36
- "五月",
37
- "六月",
38
- "七月",
39
- "八月",
40
- "九月",
41
- "十月",
42
- "十一月",
43
- "十二月"
44
- ],
45
- monthsShort: [
46
- "1月",
47
- "2月",
48
- "3月",
49
- "4月",
50
- "5月",
51
- "6月",
52
- "7月",
53
- "8月",
54
- "9月",
55
- "10月",
56
- "11月",
57
- "12月"
58
- ],
59
- ordinal: (number, period) => {
60
- const p = period ?? "";
61
- switch (p) {
62
- case "d":
63
- case "D":
64
- case "DDD": return `${number}日`;
65
- case "M": return `${number}月`;
66
- case "w":
67
- case "W": return `${number}周`;
68
- default: return number.toString();
69
- }
70
- },
71
- weekStart: 1,
72
- yearStart: 4,
73
- formats: {
74
- LT: "HH:mm",
75
- LTS: "HH:mm:ss",
76
- L: "YYYY/MM/DD",
77
- LL: "YYYY年M月D日",
78
- LLL: "YYYY年M月D日Ah点mm分",
79
- LLLL: "YYYY年M月D日ddddAh点mm分",
80
- l: "YYYY/M/D",
81
- ll: "YYYY年M月D日",
82
- lll: "YYYY年M月D日 HH:mm",
83
- llll: "YYYY年M月D日dddd HH:mm"
84
- },
85
- calendar: {
86
- sameDay: "[今天]LT",
87
- nextDay: "[明天]LT",
88
- nextWeek(refDate) {
89
- if (refDate?.week?.() !== this.week?.()) return "[下]dddLT";
90
- return "[本]dddLT";
91
- },
92
- lastDay: "[昨天]LT",
93
- lastWeek(refDate) {
94
- if (this.week?.() !== refDate?.week?.()) return "[上]dddLT";
95
- return "[本]dddLT";
96
- },
97
- sameElse: "L"
98
- },
99
- relativeTime: {
100
- future: "%s后",
101
- past: "%s前",
102
- s: "几秒",
103
- ss: "%d 秒",
104
- m: "1 分钟",
105
- mm: "%d 分钟",
106
- h: "1 小时",
107
- hh: "%d 小时",
108
- d: "1 天",
109
- dd: "%d 天",
110
- M: "1 个月",
111
- MM: "%d 个月",
112
- y: "1 年",
113
- yy: "%d 年"
114
- },
115
- meridiem: (hour, minute) => {
116
- const hm = hour * 100 + minute;
117
- if (hm < 600) return "凌晨";
118
- if (hm < 900) return "早上";
119
- if (hm < 1100) return "上午";
120
- if (hm < 1300) return "中午";
121
- if (hm < 1800) return "下午";
122
- return "晚上";
123
- }
124
- };
125
- var zh_default = localeZh;
126
-
127
- //#endregion
128
- export { zh_default };
@@ -1,188 +0,0 @@
1
- //#region src/locales/ar.ts
2
- const arabicToEnglishNumbersMap = {
3
- "١": "1",
4
- "٢": "2",
5
- "٣": "3",
6
- "٤": "4",
7
- "٥": "5",
8
- "٦": "6",
9
- "٧": "7",
10
- "٨": "8",
11
- "٩": "9",
12
- "٠": "0"
13
- };
14
- const englishToArabicNumbersMap = {
15
- 1: "١",
16
- 2: "٢",
17
- 3: "٣",
18
- 4: "٤",
19
- 5: "٥",
20
- 6: "٦",
21
- 7: "٧",
22
- 8: "٨",
23
- 9: "٩",
24
- 0: "٠"
25
- };
26
- const pluralForm = (value) => value === 0 ? 0 : value === 1 ? 1 : value === 2 ? 2 : value % 100 >= 3 && value % 100 <= 10 ? 3 : value % 100 >= 11 ? 4 : 5;
27
- const plurals = {
28
- s: [
29
- "أقل من ثانية",
30
- "ثانية واحدة",
31
- ["ثانيتان", "ثانيتين"],
32
- "%d ثوان",
33
- "%d ثانية",
34
- "%d ثانية"
35
- ],
36
- m: [
37
- "أقل من دقيقة",
38
- "دقيقة واحدة",
39
- ["دقيقتان", "دقيقتين"],
40
- "%d دقائق",
41
- "%d دقيقة",
42
- "%d دقيقة"
43
- ],
44
- h: [
45
- "أقل من ساعة",
46
- "ساعة واحدة",
47
- ["ساعتان", "ساعتين"],
48
- "%d ساعات",
49
- "%d ساعة",
50
- "%d ساعة"
51
- ],
52
- d: [
53
- "أقل من يوم",
54
- "يوم واحد",
55
- ["يومان", "يومين"],
56
- "%d أيام",
57
- "%d يومًا",
58
- "%d يوم"
59
- ],
60
- M: [
61
- "أقل من شهر",
62
- "شهر واحد",
63
- ["شهران", "شهرين"],
64
- "%d أشهر",
65
- "%d شهرا",
66
- "%d شهر"
67
- ],
68
- y: [
69
- "أقل من عام",
70
- "عام واحد",
71
- ["عامان", "عامين"],
72
- "%d أعوام",
73
- "%d عامًا",
74
- "%d عام"
75
- ]
76
- };
77
- const pluralize = (unit) => (timeValue, withoutSuffix, _token, _isFuture) => {
78
- const timeValueAsNumber = Number(timeValue);
79
- const pluralFormToUse = pluralForm(timeValueAsNumber);
80
- let plural = plurals[unit][pluralForm(timeValueAsNumber)];
81
- if (pluralFormToUse === 2) plural = plural[withoutSuffix ? 0 : 1];
82
- else plural = plural;
83
- return plural.replace(/%d/i, `${timeValue}`);
84
- };
85
- const locale = {
86
- name: "ar",
87
- weekdays: [
88
- "الأحد",
89
- "الإثنين",
90
- "الثلاثاء",
91
- "الأربعاء",
92
- "الخميس",
93
- "الجمعة",
94
- "السبت"
95
- ],
96
- weekdaysShort: [
97
- "أحد",
98
- "إثنين",
99
- "ثلاثاء",
100
- "أربعاء",
101
- "خميس",
102
- "جمعة",
103
- "سبت"
104
- ],
105
- weekdaysMin: [
106
- "ح",
107
- "ن",
108
- "ث",
109
- "ر",
110
- "خ",
111
- "ج",
112
- "س"
113
- ],
114
- months: [
115
- "يناير",
116
- "فبراير",
117
- "مارس",
118
- "أبريل",
119
- "مايو",
120
- "يونيو",
121
- "يوليو",
122
- "أغسطس",
123
- "سبتمبر",
124
- "أكتوبر",
125
- "نوفمبر",
126
- "ديسمبر"
127
- ],
128
- monthsShort: [
129
- "يناير",
130
- "فبراير",
131
- "مارس",
132
- "أبريل",
133
- "مايو",
134
- "يونيو",
135
- "يوليو",
136
- "أغسطس",
137
- "سبتمبر",
138
- "أكتوبر",
139
- "نوفمبر",
140
- "ديسمبر"
141
- ],
142
- ordinal: (n) => `${n}`,
143
- weekStart: 6,
144
- yearStart: 1,
145
- formats: {
146
- LT: "HH:mm",
147
- LTS: "HH:mm:ss",
148
- L: "D/‏M/‏YYYY",
149
- LL: "D MMMM YYYY",
150
- LLL: "D MMMM YYYY HH:mm",
151
- LLLL: "dddd D MMMM YYYY HH:mm",
152
- l: "D/‏M/‏YYYY",
153
- ll: "D MMMM YYYY",
154
- lll: "D MMMM YYYY HH:mm",
155
- llll: "dddd D MMMM YYYY HH:mm"
156
- },
157
- calendar: {
158
- sameDay: "[اليوم عند الساعة] LT",
159
- nextDay: "[غدًا عند الساعة] LT",
160
- nextWeek: "dddd [عند الساعة] LT",
161
- lastDay: "[أمس عند الساعة] LT",
162
- lastWeek: "dddd [عند الساعة] LT",
163
- sameElse: "L"
164
- },
165
- relativeTime: {
166
- future: "بعد %s",
167
- past: "منذ %s",
168
- s: pluralize("s"),
169
- ss: pluralize("s"),
170
- m: pluralize("m"),
171
- mm: pluralize("m"),
172
- h: pluralize("h"),
173
- hh: pluralize("h"),
174
- d: pluralize("d"),
175
- dd: pluralize("d"),
176
- M: pluralize("M"),
177
- MM: pluralize("M"),
178
- y: pluralize("y"),
179
- yy: pluralize("y")
180
- },
181
- meridiem: (hour, _minute, _isLowercase) => hour > 12 ? "م" : "ص",
182
- preParse: (dateString) => dateString.replace(/[١٢٣٤٥٦٧٨٩٠]/g, (match) => arabicToEnglishNumbersMap[match]).replace(/،/g, ","),
183
- postFormat: (formattedDate) => formattedDate.replace(/\d/g, (match) => englishToArabicNumbersMap[Number(match)]).replace(/,/g, "،")
184
- };
185
- var ar_default = locale;
186
-
187
- //#endregion
188
- export { ar_default };
@@ -1,43 +0,0 @@
1
- import { isArray } from "./Cb5SvF6r.js";
2
- import { normalizeUnitWithPlurals } from "./DjY7KvwG.js";
3
-
4
- //#region src/common/date-fields.ts
5
- const UNIT_FIELD_MAP = {
6
- year: "FullYear",
7
- month: "Month",
8
- date: "Date",
9
- day: "Day",
10
- hour: "Hours",
11
- minute: "Minutes",
12
- second: "Seconds",
13
- millisecond: "Milliseconds"
14
- };
15
- const prettyUnitsDate = Object.keys(UNIT_FIELD_MAP);
16
- function unitToField(unit) {
17
- const p = normalizeUnitWithPlurals(unit);
18
- return UNIT_FIELD_MAP[p];
19
- }
20
- function getUnitInDate(date, unit) {
21
- const field = unitToField(unit);
22
- const method = `get${field}`;
23
- return date[method]();
24
- }
25
- function getUnitInDateUTC(date, unit) {
26
- const field = unitToField(unit);
27
- return date[`getUTC${field}`]();
28
- }
29
- function setUnitInDate(date, unit, value) {
30
- const field = unitToField(unit);
31
- const method = `set${field}`;
32
- date[method](...isArray(value) ? value : [value]);
33
- return date;
34
- }
35
- function setUnitInDateUTC(date, unit, value) {
36
- const field = unitToField(unit);
37
- const method = `setUTC${field}`;
38
- date[method](...isArray(value) ? value : [value]);
39
- return date;
40
- }
41
-
42
- //#endregion
43
- export { getUnitInDate, getUnitInDateUTC, prettyUnitsDate, setUnitInDate, setUnitInDateUTC };