esday 0.4.1 → 0.5.0

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 +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +20 -2
  4. package/chunks/B5f9poqo.js +120 -0
  5. package/chunks/BDssPbM_.js +106 -0
  6. package/chunks/BRRrAbUl.js +56 -0
  7. package/chunks/BXRGSAJG.js +128 -0
  8. package/chunks/BeVgU2nj.js +188 -0
  9. package/chunks/BtmEtAW3.js +43 -0
  10. package/chunks/CQ57zhVp.js +106 -0
  11. package/chunks/CQJ0-ZuR.js +106 -0
  12. package/chunks/CWqzr5E5.js +108 -0
  13. package/chunks/Cb5SvF6r.js +25 -0
  14. package/chunks/Cg4ZI9v8.js +180 -0
  15. package/chunks/CoBtJ4c1.js +144 -0
  16. package/chunks/D009Z-ld.js +109 -0
  17. package/chunks/DMtTiWuY.js +127 -0
  18. package/chunks/DXHbH1CI.js +9 -0
  19. package/chunks/Dixb5KKs.js +116 -0
  20. package/chunks/DjY7KvwG.js +28 -0
  21. package/chunks/DqhiVwLi.d.ts +203 -0
  22. package/chunks/GjKpN6U-.js +135 -0
  23. package/chunks/MtjcOKi-.d.ts +6 -0
  24. package/chunks/St35qgL0.d.ts +103 -0
  25. package/chunks/Y32qdU_5.js +62 -0
  26. package/chunks/br7kModF.js +110 -0
  27. package/chunks/l2Rxo2H0.js +106 -0
  28. package/chunks/tfkJ5D3p.js +115 -0
  29. package/index.d.ts +3 -6
  30. package/index.js +556 -293
  31. package/locales/af.d.ts +8 -0
  32. package/locales/af.js +106 -0
  33. package/locales/am.d.ts +8 -0
  34. package/locales/am.js +106 -0
  35. package/locales/ar-dz.d.ts +11 -0
  36. package/locales/ar-dz.js +32 -0
  37. package/locales/ar-iq.d.ts +11 -0
  38. package/locales/ar-iq.js +14 -0
  39. package/locales/ar-kw.d.ts +11 -0
  40. package/locales/ar-kw.js +28 -0
  41. package/locales/ar-ly.d.ts +11 -0
  42. package/locales/ar-ly.js +14 -0
  43. package/locales/ar-ma.d.ts +11 -0
  44. package/locales/ar-ma.js +29 -0
  45. package/locales/ar-sa.d.ts +11 -0
  46. package/locales/ar-sa.js +29 -0
  47. package/locales/ar-tn.d.ts +11 -0
  48. package/locales/ar-tn.js +29 -0
  49. package/locales/ar.d.ts +8 -0
  50. package/locales/ar.js +3 -0
  51. package/locales/az.d.ts +8 -0
  52. package/locales/az.js +106 -0
  53. package/locales/be.d.ts +8 -0
  54. package/locales/be.js +140 -0
  55. package/locales/bg.d.ts +8 -0
  56. package/locales/bg.js +125 -0
  57. package/locales/bi.d.ts +8 -0
  58. package/locales/bi.js +106 -0
  59. package/locales/bm.d.ts +8 -0
  60. package/locales/bm.js +106 -0
  61. package/locales/bn-bd.d.ts +11 -0
  62. package/locales/bn-bd.js +24 -0
  63. package/locales/bn.d.ts +8 -0
  64. package/locales/bn.js +3 -0
  65. package/locales/bo.d.ts +8 -0
  66. package/locales/bo.js +106 -0
  67. package/locales/br.d.ts +8 -0
  68. package/locales/br.js +179 -0
  69. package/locales/bs.d.ts +8 -0
  70. package/locales/bs.js +128 -0
  71. package/locales/ca.d.ts +8 -0
  72. package/locales/ca.js +143 -0
  73. package/locales/cs.d.ts +8 -0
  74. package/locales/cs.js +182 -0
  75. package/locales/cv.d.ts +8 -0
  76. package/locales/cv.js +106 -0
  77. package/locales/cy.d.ts +8 -0
  78. package/locales/cy.js +106 -0
  79. package/locales/da.d.ts +8 -0
  80. package/locales/da.js +106 -0
  81. package/locales/de-at.d.ts +11 -0
  82. package/locales/de-at.js +44 -0
  83. package/locales/de-ch.d.ts +11 -0
  84. package/locales/de-ch.js +14 -0
  85. package/locales/de.d.ts +8 -0
  86. package/locales/de.js +3 -0
  87. package/locales/dv.d.ts +8 -0
  88. package/locales/dv.js +106 -0
  89. package/locales/el.d.ts +8 -0
  90. package/locales/el.js +115 -0
  91. package/locales/en-au.d.ts +11 -0
  92. package/locales/en-au.js +27 -0
  93. package/locales/en-ca.d.ts +11 -0
  94. package/locales/en-ca.js +27 -0
  95. package/locales/en-gb.d.ts +13 -0
  96. package/locales/en-gb.js +28 -0
  97. package/locales/en-ie.d.ts +11 -0
  98. package/locales/en-ie.js +26 -0
  99. package/locales/en-il.d.ts +11 -0
  100. package/locales/en-il.js +28 -0
  101. package/locales/en-in.d.ts +11 -0
  102. package/locales/en-in.js +26 -0
  103. package/locales/en-nz.d.ts +11 -0
  104. package/locales/en-nz.js +28 -0
  105. package/locales/en-sg.d.ts +11 -0
  106. package/locales/en-sg.js +28 -0
  107. package/locales/en-tt.d.ts +11 -0
  108. package/locales/en-tt.js +28 -0
  109. package/locales/en-us.d.ts +11 -0
  110. package/locales/en-us.js +13 -0
  111. package/locales/en.d.ts +7 -5
  112. package/locales/en.js +3 -1
  113. package/locales/eo.d.ts +8 -0
  114. package/locales/eo.js +106 -0
  115. package/locales/es-do.d.ts +11 -0
  116. package/locales/es-do.js +27 -0
  117. package/locales/es-mx.d.ts +11 -0
  118. package/locales/es-mx.js +15 -0
  119. package/locales/es-pr.d.ts +11 -0
  120. package/locales/es-pr.js +18 -0
  121. package/locales/es-us.d.ts +11 -0
  122. package/locales/es-us.js +14 -0
  123. package/locales/es.d.ts +8 -0
  124. package/locales/es.js +3 -0
  125. package/locales/et.d.ts +8 -0
  126. package/locales/et.js +142 -0
  127. package/locales/eu.d.ts +8 -0
  128. package/locales/eu.js +106 -0
  129. package/locales/fa.d.ts +8 -0
  130. package/locales/fa.js +106 -0
  131. package/locales/fi.d.ts +8 -0
  132. package/locales/fi.js +165 -0
  133. package/locales/fil.d.ts +8 -0
  134. package/locales/fil.js +106 -0
  135. package/locales/fo.d.ts +8 -0
  136. package/locales/fo.js +106 -0
  137. package/locales/fr-ca.d.ts +11 -0
  138. package/locales/fr-ca.js +18 -0
  139. package/locales/fr-ch.d.ts +11 -0
  140. package/locales/fr-ch.js +18 -0
  141. package/locales/fr.d.ts +8 -0
  142. package/locales/fr.js +3 -0
  143. package/locales/fy.d.ts +8 -0
  144. package/locales/fy.js +106 -0
  145. package/locales/ga.d.ts +8 -0
  146. package/locales/ga.js +106 -0
  147. package/locales/gd.d.ts +8 -0
  148. package/locales/gd.js +106 -0
  149. package/locales/gl.d.ts +8 -0
  150. package/locales/gl.js +116 -0
  151. package/locales/gom-deva.d.ts +8 -0
  152. package/locales/gom-deva.js +146 -0
  153. package/locales/gom-latn.d.ts +8 -0
  154. package/locales/gom-latn.js +146 -0
  155. package/locales/gu.d.ts +8 -0
  156. package/locales/gu.js +106 -0
  157. package/locales/he.d.ts +8 -0
  158. package/locales/he.js +129 -0
  159. package/locales/hi.d.ts +8 -0
  160. package/locales/hi.js +125 -0
  161. package/locales/hr.d.ts +8 -0
  162. package/locales/hr.js +189 -0
  163. package/locales/ht.d.ts +8 -0
  164. package/locales/ht.js +106 -0
  165. package/locales/hu.d.ts +8 -0
  166. package/locales/hu.js +140 -0
  167. package/locales/hy-am.d.ts +8 -0
  168. package/locales/hy-am.js +127 -0
  169. package/locales/id.d.ts +8 -0
  170. package/locales/id.js +106 -0
  171. package/locales/is.d.ts +8 -0
  172. package/locales/is.js +155 -0
  173. package/locales/it-ch.d.ts +11 -0
  174. package/locales/it-ch.js +32 -0
  175. package/locales/it.d.ts +8 -0
  176. package/locales/it.js +3 -0
  177. package/locales/ja.d.ts +15 -0
  178. package/locales/ja.js +109 -0
  179. package/locales/jv.d.ts +8 -0
  180. package/locales/jv.js +106 -0
  181. package/locales/ka.d.ts +8 -0
  182. package/locales/ka.js +126 -0
  183. package/locales/kk.d.ts +8 -0
  184. package/locales/kk.js +106 -0
  185. package/locales/km.d.ts +8 -0
  186. package/locales/km.js +106 -0
  187. package/locales/kn.d.ts +8 -0
  188. package/locales/kn.js +106 -0
  189. package/locales/ko.d.ts +8 -0
  190. package/locales/ko.js +105 -0
  191. package/locales/ku.d.ts +8 -0
  192. package/locales/ku.js +119 -0
  193. package/locales/ky.d.ts +8 -0
  194. package/locales/ky.js +106 -0
  195. package/locales/lb.d.ts +8 -0
  196. package/locales/lb.js +166 -0
  197. package/locales/lo.d.ts +8 -0
  198. package/locales/lo.js +105 -0
  199. package/locales/lt.d.ts +8 -0
  200. package/locales/lt.js +106 -0
  201. package/locales/lv.d.ts +8 -0
  202. package/locales/lv.js +106 -0
  203. package/locales/me.d.ts +8 -0
  204. package/locales/me.js +129 -0
  205. package/locales/mi.d.ts +8 -0
  206. package/locales/mi.js +106 -0
  207. package/locales/mk.d.ts +8 -0
  208. package/locales/mk.js +117 -0
  209. package/locales/ml.d.ts +8 -0
  210. package/locales/ml.js +109 -0
  211. package/locales/mn.d.ts +8 -0
  212. package/locales/mn.js +106 -0
  213. package/locales/mr.d.ts +8 -0
  214. package/locales/mr.js +215 -0
  215. package/locales/ms-my.d.ts +11 -0
  216. package/locales/ms-my.js +14 -0
  217. package/locales/ms.d.ts +8 -0
  218. package/locales/ms.js +3 -0
  219. package/locales/mt.d.ts +8 -0
  220. package/locales/mt.js +106 -0
  221. package/locales/my.d.ts +8 -0
  222. package/locales/my.js +132 -0
  223. package/locales/nb.d.ts +8 -0
  224. package/locales/nb.js +106 -0
  225. package/locales/ne.d.ts +8 -0
  226. package/locales/ne.js +106 -0
  227. package/locales/nl-be.d.ts +11 -0
  228. package/locales/nl-be.js +18 -0
  229. package/locales/nl.d.ts +8 -0
  230. package/locales/nl.js +3 -0
  231. package/locales/nn.d.ts +8 -0
  232. package/locales/nn.js +106 -0
  233. package/locales/oc-lnc.d.ts +8 -0
  234. package/locales/oc-lnc.js +126 -0
  235. package/locales/pa-in.d.ts +8 -0
  236. package/locales/pa-in.js +123 -0
  237. package/locales/pl.d.ts +8 -0
  238. package/locales/pl.js +159 -0
  239. package/locales/pt-br.d.ts +11 -0
  240. package/locales/pt-br.js +53 -0
  241. package/locales/pt.d.ts +8 -0
  242. package/locales/pt.js +3 -0
  243. package/locales/rn.d.ts +8 -0
  244. package/locales/rn.js +106 -0
  245. package/locales/ro.d.ts +8 -0
  246. package/locales/ro.js +106 -0
  247. package/locales/ru.d.ts +15 -0
  248. package/locales/ru.js +236 -0
  249. package/locales/rw.d.ts +8 -0
  250. package/locales/rw.js +106 -0
  251. package/locales/sd.d.ts +8 -0
  252. package/locales/sd.js +106 -0
  253. package/locales/se.d.ts +8 -0
  254. package/locales/se.js +106 -0
  255. package/locales/si.d.ts +8 -0
  256. package/locales/si.js +106 -0
  257. package/locales/sk.d.ts +8 -0
  258. package/locales/sk.js +162 -0
  259. package/locales/sl.d.ts +8 -0
  260. package/locales/sl.js +171 -0
  261. package/locales/sq.d.ts +8 -0
  262. package/locales/sq.js +106 -0
  263. package/locales/sr-cyrl.d.ts +11 -0
  264. package/locales/sr-cyrl.js +173 -0
  265. package/locales/sr.d.ts +8 -0
  266. package/locales/sr.js +3 -0
  267. package/locales/ss.d.ts +8 -0
  268. package/locales/ss.js +108 -0
  269. package/locales/sv-fi.d.ts +11 -0
  270. package/locales/sv-fi.js +27 -0
  271. package/locales/sv.d.ts +8 -0
  272. package/locales/sv.js +3 -0
  273. package/locales/sw.d.ts +8 -0
  274. package/locales/sw.js +106 -0
  275. package/locales/ta.d.ts +8 -0
  276. package/locales/ta.js +137 -0
  277. package/locales/te.d.ts +8 -0
  278. package/locales/te.js +109 -0
  279. package/locales/tet.d.ts +8 -0
  280. package/locales/tet.js +110 -0
  281. package/locales/tg.d.ts +8 -0
  282. package/locales/tg.js +128 -0
  283. package/locales/th.d.ts +8 -0
  284. package/locales/th.js +106 -0
  285. package/locales/tk.d.ts +8 -0
  286. package/locales/tk.js +134 -0
  287. package/locales/tl-ph.d.ts +8 -0
  288. package/locales/tl-ph.js +106 -0
  289. package/locales/tlh.d.ts +8 -0
  290. package/locales/tlh.js +152 -0
  291. package/locales/tr.d.ts +8 -0
  292. package/locales/tr.js +134 -0
  293. package/locales/tzl.d.ts +8 -0
  294. package/locales/tzl.js +123 -0
  295. package/locales/tzm-latn.d.ts +11 -0
  296. package/locales/tzm-latn.js +68 -0
  297. package/locales/tzm.d.ts +8 -0
  298. package/locales/tzm.js +3 -0
  299. package/locales/ug-cn.d.ts +8 -0
  300. package/locales/ug-cn.js +111 -0
  301. package/locales/uk.d.ts +8 -0
  302. package/locales/uk.js +194 -0
  303. package/locales/ur.d.ts +8 -0
  304. package/locales/ur.js +108 -0
  305. package/locales/uz-latn.d.ts +11 -0
  306. package/locales/uz-latn.js +68 -0
  307. package/locales/uz.d.ts +8 -0
  308. package/locales/uz.js +3 -0
  309. package/locales/vi.d.ts +8 -0
  310. package/locales/vi.js +106 -0
  311. package/locales/x-pseudo.d.ts +8 -0
  312. package/locales/x-pseudo.js +110 -0
  313. package/locales/yo.d.ts +8 -0
  314. package/locales/yo.js +106 -0
  315. package/locales/zh-cn.d.ts +11 -0
  316. package/locales/zh-cn.js +14 -0
  317. package/locales/zh-hk.d.ts +11 -0
  318. package/locales/zh-hk.js +23 -0
  319. package/locales/zh-mo.d.ts +11 -0
  320. package/locales/zh-mo.js +23 -0
  321. package/locales/zh-tw.d.ts +11 -0
  322. package/locales/zh-tw.js +23 -0
  323. package/locales/zh.d.ts +13 -4
  324. package/locales/zh.js +2 -63
  325. package/package.json +51 -25
  326. package/plugins/advancedFormat/index.d.ts +8 -0
  327. package/plugins/advancedFormat/index.js +20 -0
  328. package/plugins/advancedParse/index.d.ts +8 -0
  329. package/plugins/advancedParse/index.js +406 -0
  330. package/plugins/calendar/index.d.ts +14 -0
  331. package/plugins/calendar/index.js +33 -0
  332. package/plugins/dayOfYear/index.d.ts +13 -0
  333. package/plugins/dayOfYear/index.js +12 -0
  334. package/plugins/isBetween/index.d.ts +23 -0
  335. package/plugins/isBetween/index.js +16 -0
  336. package/plugins/isLeapYear/index.d.ts +12 -0
  337. package/plugins/isLeapYear/index.js +11 -0
  338. package/plugins/isSameOrAfter/index.d.ts +12 -0
  339. package/plugins/isSameOrAfter/index.js +10 -0
  340. package/plugins/isSameOrBefore/index.d.ts +12 -0
  341. package/plugins/isSameOrBefore/index.js +10 -0
  342. package/plugins/isToday/index.d.ts +8 -6
  343. package/plugins/isToday/index.js +10 -6
  344. package/plugins/isTomorrow/index.d.ts +12 -0
  345. package/plugins/isTomorrow/index.js +14 -0
  346. package/plugins/isYesterday/index.d.ts +12 -0
  347. package/plugins/isYesterday/index.js +14 -0
  348. package/plugins/isoWeek/index.d.ts +21 -0
  349. package/plugins/isoWeek/index.js +240 -0
  350. package/plugins/locale/index.d.ts +4 -75
  351. package/plugins/locale/index.js +6 -69
  352. package/plugins/localeData/index.d.ts +8 -0
  353. package/plugins/localeData/index.js +148 -0
  354. package/plugins/localizedFormat/index.d.ts +8 -0
  355. package/plugins/localizedFormat/index.js +88 -0
  356. package/plugins/localizedParse/index.d.ts +8 -0
  357. package/plugins/localizedParse/index.js +199 -0
  358. package/plugins/minMax/index.d.ts +13 -0
  359. package/plugins/minMax/index.js +22 -0
  360. package/plugins/objectSupport/index.d.ts +8 -0
  361. package/plugins/objectSupport/index.js +104 -0
  362. package/plugins/pluralGetSet/index.d.ts +20 -0
  363. package/plugins/pluralGetSet/index.js +16 -0
  364. package/plugins/quarterOfYear/index.d.ts +16 -0
  365. package/plugins/quarterOfYear/index.js +58 -0
  366. package/plugins/relativeTime/index.d.ts +59 -0
  367. package/plugins/relativeTime/index.js +154 -0
  368. package/plugins/toArray/index.d.ts +12 -0
  369. package/plugins/toArray/index.js +18 -0
  370. package/plugins/toObject/index.d.ts +20 -0
  371. package/plugins/toObject/index.js +18 -0
  372. package/plugins/utc/index.d.ts +14 -17
  373. package/plugins/utc/index.js +191 -37
  374. package/plugins/week/index.d.ts +21 -0
  375. package/plugins/week/index.js +360 -0
  376. package/EsDay-KXQgnL1r.d.ts +0 -89
  377. package/chunk-MLKGABMK.js +0 -7
  378. package/chunk-NUV73YDM.js +0 -60
  379. package/chunk-SQBPUYUY.js +0 -140
  380. package/plugins/customParseFormat/index.d.ts +0 -5
  381. package/plugins/customParseFormat/index.js +0 -159
@@ -0,0 +1,360 @@
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";
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 inputLimited = input.slice(0, 2);
60
+ const year = +inputLimited;
61
+ return year + (year > 68 ? 1900 : 2e3);
62
+ }
63
+ /**
64
+ * Add parsed year as 2-digit value to parsedElements
65
+ * @param parsedElements - object containing the components of a parsed date
66
+ * @param input - parsed value (year)
67
+ * @param _options - parsing options e.g. containing the locale to use
68
+ */
69
+ function twoDigitsYearUpdater(parsedElements, input, _parseOptions) {
70
+ parsedElements["weekYear"] = parseTwoDigitYear(input);
71
+ }
72
+ const weekPlugin = (_, dayClass, dayFactory) => {
73
+ const proto = dayClass.prototype;
74
+ /**
75
+ * Set the week of the parsed date.
76
+ * Must be called in the context of an EsDay instance.
77
+ * @param this - context for this function (required for getting the $conf settings)
78
+ * @param parsedDate - Date object returned by parsing function
79
+ * @param parsedElements - object containing the components of a parsed date
80
+ * @returns parsedDate with week set to parsed value
81
+ */
82
+ function _postParseWeek(parsedDate, parsedElements) {
83
+ let modifiedDate = parsedDate;
84
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.week)) && isUndefined(parsedElements.date)) {
85
+ const newEsday = createInstanceFromExist(parsedDate, this);
86
+ const parsedWeek = parsedElements.week;
87
+ const modifiedEsday = newEsday.week(parsedWeek).weekday(0);
88
+ modifiedDate = modifiedEsday.toDate();
89
+ }
90
+ return modifiedDate;
91
+ }
92
+ /**
93
+ * Set the dayOfWeek of the parsed date.
94
+ * Must be called in the context of an EsDay instance.
95
+ * @param this - context for this function (required for getting the $conf settings)
96
+ * @param parsedDate - Date object returned by parsing function
97
+ * @param parsedElements - object containing the components of a parsed date
98
+ * @returns parsedDate or invalid date (if day of week does not match)
99
+ */
100
+ function _postParseWeekDay(parsedDate, parsedElements) {
101
+ const newWeekday = parsedElements.weekday;
102
+ if (!isUndefined(newWeekday) && newWeekday !== null && (newWeekday < 0 || newWeekday > 6)) return constants_default.INVALID_DATE;
103
+ let modifiedDate = parsedDate;
104
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(newWeekday)) && isUndefined(parsedElements.date)) {
105
+ let newEsday = dayFactory(parsedDate, { utc: this["$conf"].utc });
106
+ newEsday["$conf"] = structuredClone(this["$conf"]);
107
+ if (isUndefined(parsedElements.weekYear) && isUndefined(parsedElements.week)) {
108
+ const now = /* @__PURE__ */ new Date();
109
+ newEsday = newEsday.month(now.getMonth()).date(now.getDate());
110
+ }
111
+ const modifiedEsday = newEsday.weekday(newWeekday);
112
+ modifiedDate = modifiedEsday.toDate();
113
+ }
114
+ return modifiedDate;
115
+ }
116
+ /**
117
+ * Verify that parsed date is the expected day-of-week or set the day-of-week.
118
+ * Must be called in the context of an EsDay instance.
119
+ * @param this - context for this function (required for getting the $conf settings)
120
+ * @param parsedDate - Date object returned by parsing function
121
+ * @param parsedElements - object containing the components of a parsed date
122
+ * @returns parsedDate or invalid date (if day of week does not match)
123
+ */
124
+ function _postParseDayOfWeek(parsedDate, parsedElements) {
125
+ let modifiedDate = parsedDate;
126
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.day))) {
127
+ const now = createInstanceFromExist(/* @__PURE__ */ new Date(), this);
128
+ let newEsday = createInstanceFromExist(parsedDate, this);
129
+ if (parsedElements.year !== void 0 && parsedElements.month === void 0 && parsedElements.date === void 0) {
130
+ const currentWeek = now.week();
131
+ const dayOfWeek = (parsedElements.day + 7 - newEsday.localeObject().weekStart) % 7;
132
+ newEsday = newEsday.week(currentWeek).weekday(dayOfWeek);
133
+ modifiedDate = newEsday.toDate();
134
+ }
135
+ if (newEsday.day() !== parsedElements.day) modifiedDate = constants_default.INVALID_DATE;
136
+ }
137
+ return modifiedDate;
138
+ }
139
+ /**
140
+ * Set weekYear of parsed date.
141
+ * Must be called in the context of an EsDay instance.
142
+ * @param this - context for this function (required for getting the $conf settings)
143
+ * @param parsedDate - Date object returned by parsing function
144
+ * @param parsedElements - object containing the components of a parsed date
145
+ * @returns parsedDate with weekYear set to parsed value
146
+ */
147
+ function _postParseYear(parsedDate, parsedElements) {
148
+ let modifiedDate = parsedDate;
149
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.weekYear))) {
150
+ const newEsday = createInstanceFromExist(parsedDate, this);
151
+ const parsedWeekYear = parsedElements.weekYear;
152
+ if (Object.keys(parsedElements).length === 1) {
153
+ const now = /* @__PURE__ */ new Date();
154
+ let modifiedEsday = newEsday.weekYear(parsedWeekYear);
155
+ modifiedEsday = modifiedEsday.year(parsedWeekYear).month(now.getMonth()).date(now.getDate()).weekday(0);
156
+ modifiedDate = modifiedEsday.toDate();
157
+ } else if (!isUndefined(parsedElements.week)) {
158
+ const modifiedEsday = newEsday.weekYear(parsedWeekYear);
159
+ modifiedDate = modifiedEsday.toDate();
160
+ }
161
+ }
162
+ return modifiedDate;
163
+ }
164
+ proto.week = function(newWeek) {
165
+ if (newWeek !== void 0) {
166
+ const currentWeekday = this.weekday();
167
+ const h = this.hour();
168
+ const m = this.minute();
169
+ const s = this.second();
170
+ const ms = this.millisecond();
171
+ return this.add((newWeek - this.week()) * 7, constants_default.DAY).weekday(currentWeekday).hour(h, m, s, ms);
172
+ }
173
+ const yearStart = this.localeObject?.().yearStart || constants_default.INDEX_THURSDAY;
174
+ if (this.month() === 11 && this.date() > 25) {
175
+ const nextYearStartDay = this.startOf(constants_default.YEAR).add(1, constants_default.YEAR).date(yearStart);
176
+ const thisEndOfWeek = this.endOf(constants_default.WEEK);
177
+ if (nextYearStartDay.isBefore(thisEndOfWeek)) return 1;
178
+ }
179
+ const yearStartDay = this.startOf(constants_default.YEAR).date(yearStart);
180
+ const yearStartWeek = yearStartDay.startOf(constants_default.WEEK).subtract(1, constants_default.MS);
181
+ const diffInWeek = this.diff(yearStartWeek, constants_default.WEEK, true);
182
+ if (diffInWeek < 0) return this.startOf(constants_default.WEEK).week();
183
+ return Math.ceil(diffInWeek);
184
+ };
185
+ proto.weeks = proto.week;
186
+ /**
187
+ * Get or set the locale aware day of the week.
188
+ * 0 is always the first day of the week (according to locale.weekStart property),
189
+ * 6 is always the last day of the week.
190
+ * E.g. in Europe 0=Monday ... 6=Sunday.
191
+ * If no locale is loaded, Monday is used as start of week.
192
+ */
193
+ dayClass.prototype.weekday = function(newWeekday) {
194
+ const weekStart = this.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
195
+ const dow = this.day();
196
+ const weekday = (dow < weekStart ? dow + 7 : dow) - weekStart;
197
+ if (newWeekday !== void 0) return this.subtract(weekday, constants_default.DAY).add(newWeekday, constants_default.DAY);
198
+ return weekday;
199
+ };
200
+ /**
201
+ * Gets or sets the year of the week. This year may differ from
202
+ * the calendar year at the start or the end of a year (depending on
203
+ * 'yearStart').
204
+ * Setting the weekYear will keep the week number and the day of the week.
205
+ * If no locale is loaded, Monday is used as start of week.
206
+ */
207
+ proto.weekYear = function(newWeekYear) {
208
+ if (newWeekYear !== void 0) {
209
+ if (this.weekYear() === newWeekYear) return this;
210
+ const currentWeek = this.week();
211
+ const currentWeekday = this.weekday();
212
+ let newDate = this.year(newWeekYear).week(currentWeek).weekday(currentWeekday);
213
+ if (newDate.weekYear() !== newWeekYear) {
214
+ const yearDiff = newWeekYear - newDate.weekYear();
215
+ newDate = newDate.add(yearDiff, constants_default.YEAR).weekday(currentWeekday);
216
+ }
217
+ return newDate;
218
+ }
219
+ const month = this.month();
220
+ const weekOfYear = this.week();
221
+ const year = this.year();
222
+ if (weekOfYear === 1 && month === 11) return year + 1;
223
+ if (month === 0 && weekOfYear >= 52) return year - 1;
224
+ return year;
225
+ };
226
+ /**
227
+ * Get the number of weeks in the current year.
228
+ * Most years have 52 weeks, some have 53 weeks.
229
+ */
230
+ proto.weeksInYear = function() {
231
+ const weekStart = this.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
232
+ const yearStart = this.localeObject?.().yearStart ?? constants_default.INDEX_THURSDAY;
233
+ const preWeekStart = ((weekStart + 6) % 7 + 8 - yearStart) % 7;
234
+ const prePreWeekStart = (preWeekStart + 6) % 7;
235
+ const yearStartWeekday = this.month(0).date(1).day();
236
+ const year = this.year();
237
+ const isLeapYear = year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
238
+ if (yearStartWeekday === preWeekStart || isLeapYear && yearStartWeekday === prePreWeekStart) return 53;
239
+ return 52;
240
+ };
241
+ const oldStartOf = proto.startOf;
242
+ proto.startOf = function(units) {
243
+ if (units === constants_default.WEEK) {
244
+ let newDate = this.clone();
245
+ const weekStart = newDate.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
246
+ const newDateWeekday = newDate.day();
247
+ const diff = (newDateWeekday < weekStart ? newDateWeekday + 7 : newDateWeekday) - weekStart;
248
+ const newDayOfMonth = newDate.date() - diff;
249
+ newDate = newDate.date(newDayOfMonth);
250
+ return newDate["$set"](constants_default.HOUR, [
251
+ 0,
252
+ 0,
253
+ 0,
254
+ 0
255
+ ]);
256
+ }
257
+ return oldStartOf.call(this, units);
258
+ };
259
+ const oldEndOf = proto.endOf;
260
+ proto.endOf = function(units) {
261
+ if (units === constants_default.WEEK) {
262
+ let newDate = this.clone();
263
+ const weekStart = newDate.localeObject?.().weekStart ?? constants_default.INDEX_MONDAY;
264
+ const newDateWeekday = newDate.day();
265
+ const diff = (newDateWeekday < weekStart ? newDateWeekday + 7 : newDateWeekday) - weekStart;
266
+ const newDayOfMonth = newDate.date() + (6 - diff);
267
+ newDate = newDate.date(newDayOfMonth);
268
+ return newDate["$set"](constants_default.HOUR, [
269
+ 23,
270
+ 59,
271
+ 59,
272
+ 999
273
+ ]);
274
+ }
275
+ return oldEndOf.call(this, units);
276
+ };
277
+ const oldGet = proto.get;
278
+ proto.get = function(unit) {
279
+ const normalizedUnit = normalizeUnitWithPlurals(unit);
280
+ if (normalizedUnit === constants_default.WEEK) return this.week();
281
+ return oldGet.call(this, unit);
282
+ };
283
+ const old$set = proto["$set"];
284
+ 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]);
288
+ return old$set.call(this, unit, values);
289
+ };
290
+ const additionalTokens = {
291
+ w: (sourceDate) => sourceDate.week().toString(),
292
+ ww: (sourceDate) => padStart(sourceDate.week(), 2, "0"),
293
+ wo: (sourceDate) => toOrdinal(sourceDate, sourceDate.week()),
294
+ e: (sourceDate) => sourceDate.weekday().toString(),
295
+ gg: (sourceDate) => padStart(sourceDate.weekYear(), 2, "0").slice(-2),
296
+ gggg: (sourceDate) => padStart(sourceDate.weekYear(), 4, "0")
297
+ };
298
+ dayFactory.addFormatTokenDefinitions(additionalTokens);
299
+ const parseTokensDefinitions = {
300
+ d: [
301
+ match1to2,
302
+ match1to2,
303
+ addDayOfWeek("day", dayFactory),
304
+ _postParseDayOfWeek
305
+ ],
306
+ dd: [
307
+ matchWord,
308
+ matchWord,
309
+ addDayOfWeek("weekdaysMin", dayFactory),
310
+ _postParseDayOfWeek
311
+ ],
312
+ ddd: [
313
+ matchWord,
314
+ matchWord,
315
+ addDayOfWeek("weekdaysShort", dayFactory),
316
+ _postParseDayOfWeek
317
+ ],
318
+ dddd: [
319
+ matchWord,
320
+ matchWord,
321
+ addDayOfWeek("weekdays", dayFactory),
322
+ _postParseDayOfWeek
323
+ ],
324
+ w: [
325
+ match1to2,
326
+ match1to2NoLeadingZero,
327
+ addWeek("week"),
328
+ _postParseWeek
329
+ ],
330
+ ww: [
331
+ match1to2,
332
+ match2,
333
+ addWeek("week"),
334
+ _postParseWeek
335
+ ],
336
+ e: [
337
+ match1to2,
338
+ match1,
339
+ addWeek("weekday"),
340
+ _postParseWeekDay
341
+ ],
342
+ gg: [
343
+ match1to4,
344
+ match2,
345
+ twoDigitsYearUpdater,
346
+ _postParseYear
347
+ ],
348
+ gggg: [
349
+ match1to4,
350
+ match4,
351
+ addWeek("weekYear"),
352
+ _postParseYear
353
+ ]
354
+ };
355
+ dayFactory.addParseTokenDefinitions?.(parseTokensDefinitions);
356
+ };
357
+ var week_default = weekPlugin;
358
+
359
+ //#endregion
360
+ export { week_default as default };
@@ -1,89 +0,0 @@
1
- declare const UNIT_MAP: {
2
- readonly y: "year";
3
- readonly M: "month";
4
- readonly D: "date";
5
- readonly d: "day";
6
- readonly h: "hour";
7
- readonly m: "minute";
8
- readonly s: "second";
9
- readonly ms: "millisecond";
10
- readonly w: "week";
11
- };
12
- type ShortUnit = keyof typeof UNIT_MAP;
13
- type PrettyUnitType = typeof UNIT_MAP[ShortUnit];
14
- type UnitType = ShortUnit | PrettyUnitType;
15
- type PrettyUnit<T extends UnitType> = T extends ShortUnit ? typeof UNIT_MAP[T] : T;
16
- type UnionUnit<T extends ShortUnit> = T | PrettyUnit<T>;
17
- type UnitYear = UnionUnit<'y'>;
18
- type UnitMonth = UnionUnit<'M'>;
19
- type UnitDate = UnionUnit<'D'>;
20
- type UnitDay = UnionUnit<'d'>;
21
- type UnitHour = UnionUnit<'h'>;
22
- type UnitMin = UnionUnit<'m'>;
23
- type UnitSecond = UnionUnit<'s'>;
24
- type UnitMs = UnionUnit<'ms'>;
25
- type UnitWeek = UnionUnit<'w'>;
26
-
27
- type SimpleType = string | number | boolean | null | undefined;
28
- type SimpleObject = Record<string, SimpleType>;
29
-
30
- type EsDayFactoryParserFn = (d?: DateType, ...others: (SimpleType | {
31
- [key: string]: SimpleType;
32
- })[]) => EsDay;
33
- interface EsDayFactory {
34
- (...args: Parameters<EsDayFactoryParserFn>): ReturnType<EsDayFactoryParserFn>;
35
- extend: <T extends {}>(plugin: EsDayPlugin<T>, option?: T) => EsDayFactory;
36
- }
37
- type EsDayPlugin<T extends {}> = (option: T, dayTsClass: typeof EsDay, esday: EsDayFactory) => void;
38
- type DateType = EsDay | Date | string | number | number[] | null | undefined | object;
39
-
40
- declare interface EsDay {
41
- year: (() => number) & ((year: number, month?: number, date?: number) => EsDay);
42
- month: (() => number) & ((month: number, date?: number) => EsDay);
43
- date: (() => number) & ((date: number) => EsDay);
44
- day: (() => number) & ((day: number) => EsDay);
45
- hour: (() => number) & ((hours: number, min?: number, sec?: number, ms?: number) => EsDay);
46
- minute: (() => number) & ((min: number, sec?: number, ms?: number) => EsDay);
47
- second: (() => number) & ((sec: number, ms?: number) => EsDay);
48
- millisecond: (() => number) & ((ms: number) => EsDay);
49
- }
50
- declare class EsDay {
51
- private $d;
52
- /**
53
- * mainly for plugin compatibility
54
- * store data such as locale name, utc mode, etc.
55
- */
56
- private $conf;
57
- constructor(d: Exclude<DateType, EsDay>, conf?: SimpleObject);
58
- private parse;
59
- private $parseDate;
60
- isSame(that: DateType, units?: UnitType): boolean;
61
- isAfter(that: DateType, units?: UnitType): boolean;
62
- isBefore(that: DateType, units?: UnitType): boolean;
63
- valueOf(): number;
64
- unix(): number;
65
- isValid(): boolean;
66
- clone(): EsDay;
67
- format(formatStr?: string): string;
68
- utcOffset(): number;
69
- startOf(units: UnitType): EsDay;
70
- endOf(units: UnitType): EsDay;
71
- add(number: number, units: UnitType): EsDay;
72
- subtract(number: number, units: UnitType): EsDay;
73
- get(units: Exclude<UnitType, UnitWeek>): number;
74
- set(unit: UnitYear, year: number, month?: number, date?: number): EsDay;
75
- set(unit: UnitMonth, month: number, date?: number): EsDay;
76
- set(unit: UnitDate, date: number): EsDay;
77
- set(unit: UnitDay, day: number): EsDay;
78
- set(unit: UnitHour, hours: number, min?: number, sec?: number, ms?: number): EsDay;
79
- set(unit: UnitMin, min: number, sec?: number, ms?: number): EsDay;
80
- set(unit: UnitSecond, sec: number, ms?: number): EsDay;
81
- set(unit: UnitMs, ms: number): EsDay;
82
- toDate(): Date;
83
- toJSON(): string | null;
84
- toISOString(): string;
85
- toString(): string;
86
- private $set;
87
- }
88
-
89
- export { type DateType as D, type EsDayFactory as E, type PrettyUnit as P, type UnitType as U, EsDay as a, type PrettyUnitType as b, type EsDayFactoryParserFn as c, type EsDayPlugin as d };
package/chunk-MLKGABMK.js DELETED
@@ -1,7 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export { __export };
package/chunk-NUV73YDM.js DELETED
@@ -1,60 +0,0 @@
1
- // src/locales/en.ts
2
- var localeEn = {
3
- name: "en",
4
- weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
5
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
6
- weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
7
- weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
8
- monthsShort: [
9
- "Jan",
10
- "Feb",
11
- "Mar",
12
- "Apr",
13
- "May",
14
- "Jun",
15
- "Jul",
16
- "Aug",
17
- "Sep",
18
- "Oct",
19
- "Nov",
20
- "Dec"
21
- ],
22
- weekStart: 1,
23
- yearStart: 4,
24
- formats: {
25
- LT: "HH:mm",
26
- LTS: "HH:mm:ss",
27
- L: "DD/MM/YYYY",
28
- LL: "D MMMM YYYY",
29
- LLL: "D MMMM YYYY HH:mm",
30
- LLLL: "dddd, D MMMM YYYY HH:mm"
31
- },
32
- relativeTime: {
33
- future: "in %s",
34
- past: "%s ago",
35
- s: "a few seconds",
36
- m: "a minute",
37
- mm: "%d minutes",
38
- h: "an hour",
39
- hh: "%d hours",
40
- d: "a day",
41
- dd: "%d days",
42
- M: "a month",
43
- MM: "%d months",
44
- y: "a year",
45
- yy: "%d years"
46
- },
47
- meridiem: (hour, minute, isLowercase) => {
48
- const m = hour < 12 ? "AM" : "PM";
49
- return isLowercase ? m.toLowerCase() : m;
50
- },
51
- ordinal: (n) => {
52
- const s = ["th", "st", "nd", "rd"];
53
- const v = n % 100;
54
- return `[${n}${s[(v - 20) % 10] || s[v] || s[0]}]`;
55
- },
56
- invalidDate: "Invalid date"
57
- };
58
- var en_default = localeEn;
59
-
60
- export { en_default };
package/chunk-SQBPUYUY.js DELETED
@@ -1,140 +0,0 @@
1
- import { __export } from './chunk-MLKGABMK.js';
2
-
3
- // src/common/constant.ts
4
- var constant_exports = {};
5
- __export(constant_exports, {
6
- DATE: () => DATE,
7
- DAY: () => DAY,
8
- FORMAT_DEFAULT: () => FORMAT_DEFAULT,
9
- HOUR: () => HOUR,
10
- INDEX_MONDAY: () => INDEX_MONDAY,
11
- INVALID_DATE_STRING: () => INVALID_DATE_STRING,
12
- MILLISECONDS_A_DAY: () => MILLISECONDS_A_DAY,
13
- MILLISECONDS_A_HOUR: () => MILLISECONDS_A_HOUR,
14
- MILLISECONDS_A_MINUTE: () => MILLISECONDS_A_MINUTE,
15
- MILLISECONDS_A_SECOND: () => MILLISECONDS_A_SECOND,
16
- MILLISECONDS_A_WEEK: () => MILLISECONDS_A_WEEK,
17
- MIN: () => MIN,
18
- MONTH: () => MONTH,
19
- MS: () => MS,
20
- REGEX_FORMAT: () => REGEX_FORMAT,
21
- REGEX_PARSE: () => REGEX_PARSE,
22
- SECOND: () => SECOND,
23
- SECONDS_A_DAY: () => SECONDS_A_DAY,
24
- SECONDS_A_HOUR: () => SECONDS_A_HOUR,
25
- SECONDS_A_MINUTE: () => SECONDS_A_MINUTE,
26
- SECONDS_A_WEEK: () => SECONDS_A_WEEK,
27
- WEEK: () => WEEK,
28
- YEAR: () => YEAR
29
- });
30
- var SECONDS_A_MINUTE = 60;
31
- var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
32
- var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
33
- var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
34
- var MILLISECONDS_A_SECOND = 1e3;
35
- var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
36
- var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
37
- var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
38
- var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND;
39
- var INDEX_MONDAY = 1;
40
- var MS = "millisecond";
41
- var SECOND = "second";
42
- var MIN = "minute";
43
- var HOUR = "hour";
44
- var DAY = "day";
45
- var WEEK = "week";
46
- var MONTH = "month";
47
- var YEAR = "year";
48
- var DATE = "date";
49
- var FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ssZ";
50
- var INVALID_DATE_STRING = "Invalid Date";
51
- var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
52
- var REGEX_FORMAT = /\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
53
-
54
- // src/common/is.ts
55
- function isUndefined(value) {
56
- return value === void 0;
57
- }
58
- function undefinedOr(v, or) {
59
- return isUndefined(v) ? or : v;
60
- }
61
- function isObject(value) {
62
- return typeof value === "object" && value !== null;
63
- }
64
- function isEmptyObject(value) {
65
- return isObject(value) && Object.keys(value).length === 0;
66
- }
67
- function isString(value) {
68
- return typeof value === "string";
69
- }
70
- function isArray(value) {
71
- return Array.isArray(value);
72
- }
73
-
74
- // src/common/unit.ts
75
- var UNIT_MAP = {
76
- y: YEAR,
77
- M: MONTH,
78
- D: DATE,
79
- d: DAY,
80
- h: HOUR,
81
- m: MIN,
82
- s: SECOND,
83
- ms: MS,
84
- w: WEEK
85
- };
86
- function prettyUnit(u) {
87
- const maybePrettyUnit = UNIT_MAP[u];
88
- return maybePrettyUnit || u;
89
- }
90
-
91
- // src/common/date-fields.ts
92
- var UNIT_FIELD_MAP = {
93
- year: "FullYear",
94
- month: "Month",
95
- date: "Date",
96
- day: "Day",
97
- hour: "Hours",
98
- minute: "Minutes",
99
- second: "Seconds",
100
- millisecond: "Milliseconds"
101
- };
102
- function unitToField(unit) {
103
- const p = prettyUnit(unit);
104
- return UNIT_FIELD_MAP[p];
105
- }
106
- function getUnitInDate(date, unit, utc) {
107
- const field = unitToField(unit);
108
- const method = `get${utc ? "UTC" : ""}${field}`;
109
- return date[method]();
110
- }
111
- function setUnitInDate(date, unit, value, utc) {
112
- const field = unitToField(unit);
113
- const method = `set${utc ? "UTC" : ""}${field}`;
114
- date[method](...isArray(value) ? value : [value]);
115
- return date;
116
- }
117
-
118
- // src/common/esday-inst.ts
119
- function createInstanceFromExist(d, existInst) {
120
- const newInst = existInst.clone();
121
- newInst["$d"] = d;
122
- return newInst;
123
- }
124
-
125
- // src/common/str-utils.ts
126
- function padStart(origin, length, pad) {
127
- const originStr = String(origin);
128
- if (!originStr || originStr.length >= length)
129
- return originStr;
130
- return `${Array.from({ length: length + 1 - originStr.length }).join(pad)}${originStr}`;
131
- }
132
- function padZoneStr(utcOffset) {
133
- const negMinutes = -utcOffset;
134
- const minutes = Math.abs(negMinutes);
135
- const hourOffset = Math.floor(minutes / 60);
136
- const minuteOffset = minutes % 60;
137
- return `${negMinutes <= 0 ? "+" : "-"}${padStart(hourOffset, 2, "0")}:${padStart(minuteOffset, 2, "0")}`;
138
- }
139
-
140
- export { constant_exports, createInstanceFromExist, getUnitInDate, isEmptyObject, isObject, isString, isUndefined, padStart, padZoneStr, prettyUnit, setUnitInDate, undefinedOr };
@@ -1,5 +0,0 @@
1
- import { d as EsDayPlugin } from '../../EsDay-KXQgnL1r.js';
2
-
3
- declare const customParseFormatPlugin: EsDayPlugin<{}>;
4
-
5
- export { customParseFormatPlugin };