esday 0.3.0 → 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 (378) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +51 -0
  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 +552 -326
  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 +8 -0
  112. package/locales/en.js +3 -0
  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 +15 -0
  324. package/locales/zh.js +3 -0
  325. package/package.json +79 -21
  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 -0
  351. package/plugins/locale/index.js +7 -0
  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 +19 -0
  373. package/plugins/utc/index.js +194 -0
  374. package/plugins/week/index.d.ts +21 -0
  375. package/plugins/week/index.js +360 -0
  376. package/EsDay-CKy0jEj2.d.ts +0 -68
  377. package/plugins/customParseFormat/index.d.ts +0 -5
  378. package/plugins/customParseFormat/index.js +0 -159
@@ -0,0 +1,199 @@
1
+ import { isArray, isString, isUndefined } from "../../chunks/Cb5SvF6r.js";
2
+
3
+ //#region src/plugins/localizedParse/index.ts
4
+ const match2 = /\d{2}/;
5
+ const match1to2 = /\d\d?/;
6
+ const matchWord = /\d*[^-_:/,()\s\d]+/;
7
+ /**
8
+ * Add 'input' to parsedElements as 'hours'.
9
+ * @param parsedElements - object containing the components of a parsed date
10
+ * @param input - parsed component of a date, to be transformed and inserted in parsedElements
11
+ * @param options - parsing options e.g. containing the locale to use
12
+ */
13
+ function addHour(parsedElements, input, _parseOptions) {
14
+ parsedElements["hours"] = +input;
15
+ }
16
+ /**
17
+ * Convert parsed string to boolean 'afternoon'
18
+ * @param locale - Locale to use
19
+ * @param input - parsed date component
20
+ * @param isLowerCase - should this be a lowercase meridiem string?
21
+ * @returns is input an 'afternoon' string for given locale
22
+ */
23
+ function meridiemMatch(locale, input, isLowerCase) {
24
+ let isAfternoon = false;
25
+ const { meridiem } = locale;
26
+ if (meridiem) {
27
+ for (let i = 1; i <= 24; i += 1) if (input === meridiem(i, 0, isLowerCase)) {
28
+ isAfternoon = i >= 12;
29
+ break;
30
+ }
31
+ } else isAfternoon = input === (isLowerCase ? "pm" : "PM");
32
+ return isAfternoon;
33
+ }
34
+ /**
35
+ * Create a function that will parse the input string as meridiem string and
36
+ * add it to the given 'parsedElements' containing the date&time components.
37
+ * @param isLowerCase - parse the meridiem string as lowercase
38
+ * @param esday - global esday object (to get locale by its name)
39
+ * @returns function that will add the given value to date&time component as 'afternoon'
40
+ */
41
+ function addAfternoon(isLowerCase, esday) {
42
+ return function meridiemUpdater(parsedElements, input, parseOptions) {
43
+ const localeName = parseOptions["locale"];
44
+ const locale = esday.getLocale(localeName);
45
+ const meridiem = meridiemMatch(locale, input, isLowerCase);
46
+ if (!isUndefined(meridiem)) parsedElements.afternoon = meridiem;
47
+ };
48
+ }
49
+ /**
50
+ * Parse day of month as ordinal number.
51
+ * Create a function that will parse the input string as day of month as ordinal
52
+ * number and add it to the given 'parsedElements' containing the date&time components.
53
+ * @param esday - global esday object (to get locale by its name)
54
+ * @returns function that will add the given value to date&time component as 'afternoon'
55
+ */
56
+ function addDayOfMonthOrdinal(esday) {
57
+ return function monthOrdinalUpdater(parsedElements, input, parseOptions) {
58
+ const localeName = parseOptions["locale"];
59
+ const { ordinal } = esday.getLocale(localeName);
60
+ let dateValue;
61
+ const splittedInput = input.match(/^[^\d]*(\d+)[^\d]*$/);
62
+ if (splittedInput !== null) {
63
+ dateValue = +splittedInput[1];
64
+ const dateAsOrdinal = ordinal?.(dateValue);
65
+ if (dateAsOrdinal === void 0 || dateAsOrdinal === input) parsedElements.date = dateValue;
66
+ }
67
+ };
68
+ }
69
+ /**
70
+ * Create a function that will convert the value from the input string
71
+ * to a month number and add it to the given 'parsedElements' containing
72
+ * the date&time components.
73
+ * @param property - name of the list of month names to use
74
+ * @param esday - global esday object (to get locale by its name)
75
+ * @returns function that will add the given value to date&time component
76
+ */
77
+ function addMonth(property, esday) {
78
+ return function monthUpdater(parsedElements, input, parseOptions) {
79
+ const localeName = parseOptions["locale"];
80
+ const months = esday.getLocale(localeName)[property];
81
+ let monthNames;
82
+ if (isArray(months)) monthNames = months;
83
+ else monthNames = months.standalone;
84
+ const matchIndex = monthNames.indexOf(input) + 1;
85
+ parsedElements.month = matchIndex % 12 || matchIndex;
86
+ };
87
+ }
88
+ /**
89
+ * Replace locale dependent token in given format with values from locale definition
90
+ * e.g. 'LTS' with 'h:mm:ss A'
91
+ * @param format - original format (with locale dependent tokens)
92
+ * @param currentLocale - Locale to use
93
+ * @returns format with locale dependent tokens replaced
94
+ */
95
+ function replaceLocaleTokens(format, currentLocale) {
96
+ const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
97
+ function replaceLongDateFormatTokens(input) {
98
+ return currentLocale.formats[input] ?? input;
99
+ }
100
+ return format.replace(localFormattingTokens, replaceLongDateFormatTokens);
101
+ }
102
+ const localizedParsePlugin = (_, dayClass, dayFactory) => {
103
+ const proto = dayClass.prototype;
104
+ /**
105
+ * Convert the hours to 24h format.
106
+ * Must be called in the context of an EsDay instance.
107
+ * @param this - context for this function (required for getting the $conf settings)
108
+ * @param parsedDate - Date object returned by parsing function
109
+ * @param parsedElements - object containing the components of a parsed date
110
+ * @returns parsedDate with hours converted to 24h format
111
+ */
112
+ function _postParseMeridiem(parsedDate, parsedElements) {
113
+ let modifiedDate = parsedDate;
114
+ if (!(Number.isNaN(parsedDate.valueOf()) || isUndefined(parsedElements.afternoon))) {
115
+ let parsedHours;
116
+ let newEsday = dayFactory(parsedDate, { utc: this["$conf"].utc });
117
+ newEsday["$conf"] = structuredClone(this["$conf"]);
118
+ parsedHours = newEsday.hour();
119
+ if (parsedHours < 12 && parsedElements.afternoon) newEsday = newEsday.hour(parsedHours + 12);
120
+ else if (parsedHours === 12 && !parsedElements.afternoon) newEsday = newEsday.hour(0);
121
+ modifiedDate = newEsday.toDate();
122
+ }
123
+ return modifiedDate;
124
+ }
125
+ /**
126
+ * List of parsing tokens; the key of an entry in this list is
127
+ * the token to be parsed and the value is a 3-entries-array with
128
+ * the 1st entry being the regex for parsing in 'standard' mode,
129
+ * the 2nd entry being the regex for parsing in 'strict' mode and
130
+ * the 3rd entry being a function that will add the corresponding
131
+ * value to an object containing all the date&time elements (year,
132
+ * month, day, ...).
133
+ */
134
+ const parseTokensDefinitions = {
135
+ h: [
136
+ match1to2,
137
+ match1to2,
138
+ addHour
139
+ ],
140
+ hh: [
141
+ match1to2,
142
+ match2,
143
+ addHour
144
+ ],
145
+ a: [
146
+ matchWord,
147
+ matchWord,
148
+ addAfternoon(true, dayFactory),
149
+ _postParseMeridiem
150
+ ],
151
+ A: [
152
+ matchWord,
153
+ matchWord,
154
+ addAfternoon(false, dayFactory),
155
+ _postParseMeridiem
156
+ ],
157
+ Do: [
158
+ matchWord,
159
+ matchWord,
160
+ addDayOfMonthOrdinal(dayFactory)
161
+ ],
162
+ MMM: [
163
+ matchWord,
164
+ matchWord,
165
+ addMonth("monthsShort", dayFactory)
166
+ ],
167
+ MMMM: [
168
+ matchWord,
169
+ matchWord,
170
+ addMonth("months", dayFactory)
171
+ ]
172
+ };
173
+ dayFactory.addParseTokenDefinitions(parseTokensDefinitions);
174
+ const oldParse = proto["$parse"];
175
+ proto["$parse"] = function(d) {
176
+ if (!isString(d)) {
177
+ oldParse.call(this, d);
178
+ return;
179
+ }
180
+ const format = this["$conf"].args_1;
181
+ let currentLocale = this.localeObject?.();
182
+ const arg2 = this["$conf"].args_2;
183
+ if (!isUndefined(arg2) && typeof arg2 === "string") currentLocale = dayFactory.getLocale(arg2);
184
+ const parseOptions = this["$conf"].parseOptions ?? {};
185
+ parseOptions.locale = currentLocale.name;
186
+ this["$conf"].parseOptions = parseOptions;
187
+ let newFormat = format;
188
+ if (isString(newFormat)) newFormat = replaceLocaleTokens(newFormat, currentLocale);
189
+ else if (isArray(newFormat)) for (let i = 0; i < newFormat.length; i++) newFormat[i] = replaceLocaleTokens(newFormat[i], currentLocale);
190
+ this["$conf"].args_1 = newFormat;
191
+ let newDate = d;
192
+ if (currentLocale.preParse !== void 0) newDate = currentLocale.preParse(d);
193
+ oldParse.call(this, newDate);
194
+ };
195
+ };
196
+ var localizedParse_default = localizedParsePlugin;
197
+
198
+ //#endregion
199
+ export { localizedParse_default as default };
@@ -0,0 +1,13 @@
1
+ import { DateType, EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
+ import "../../chunks/MtjcOKi-.js";
3
+
4
+ //#region src/plugins/minMax/index.d.ts
5
+ declare module 'esday' {
6
+ interface EsDayFactory {
7
+ max: (...dates: DateType[]) => EsDay;
8
+ min: (...dates: DateType[]) => EsDay;
9
+ }
10
+ }
11
+ declare const minMaxPlugin: EsDayPlugin<{}>;
12
+ //#endregion
13
+ export { minMaxPlugin as default };
@@ -0,0 +1,22 @@
1
+ import { isArray } from "../../chunks/Cb5SvF6r.js";
2
+
3
+ //#region src/plugins/minMax/index.ts
4
+ const minMaxPlugin = (_, _dayClass, dayFactory) => {
5
+ const sortBy = (method, dates) => {
6
+ if (!dates || dates.length === 0 || dates.length === 1 && (!dates[0] || isArray(dates[0]) && dates[0].length === 0)) return dayFactory();
7
+ if (dates.length === 1 && isArray(dates[0]) && dates[0].length > 0) dates = dates[0];
8
+ dates = dates.filter((date) => date);
9
+ let result = dates[0];
10
+ for (let i = 1; i < dates.length; i++) {
11
+ const inst = dayFactory(dates[i]);
12
+ if (!inst.isValid() || inst[method](result)) result = dates[i];
13
+ }
14
+ return dayFactory(result);
15
+ };
16
+ dayFactory.max = (...dates) => sortBy("isAfter", dates);
17
+ dayFactory.min = (...dates) => sortBy("isBefore", dates);
18
+ };
19
+ var minMax_default = minMaxPlugin;
20
+
21
+ //#endregion
22
+ export { minMax_default as default };
@@ -0,0 +1,8 @@
1
+ import { EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
+ import "../../chunks/MtjcOKi-.js";
3
+
4
+ //#region src/plugins/objectSupport/index.d.ts
5
+
6
+ declare const objectSupportPlugin: EsDayPlugin<{}>;
7
+ //#endregion
8
+ export { objectSupportPlugin as default };
@@ -0,0 +1,104 @@
1
+ import { constants_default } from "../../chunks/Y32qdU_5.js";
2
+ import { isEmptyObject, isObject } from "../../chunks/Cb5SvF6r.js";
3
+ import { normalizeUnitWithPlurals } from "../../chunks/DjY7KvwG.js";
4
+ import { createInstanceFromExist } from "../../chunks/DXHbH1CI.js";
5
+
6
+ //#region src/plugins/objectSupport/index.ts
7
+ const objectSupportPlugin = (_, dayClass, _dayFactory) => {
8
+ const proto = dayClass.prototype;
9
+ const oldParse = proto["$parse"];
10
+ proto["$parse"] = function(date) {
11
+ if (isObject(date) && !(date instanceof Date) && date !== null && !isEmptyObject(date) && !Array.isArray(date)) {
12
+ const dateKeys = Object.keys(date);
13
+ const now = createInstanceFromExist(/* @__PURE__ */ new Date(), this);
14
+ const dateArrayTuple = [
15
+ now.year(),
16
+ 1,
17
+ 1,
18
+ 0,
19
+ 0,
20
+ 0,
21
+ 0
22
+ ];
23
+ const dateIncludesYear = dateKeys.includes("y") || dateKeys.includes(constants_default.YEAR) || dateKeys.includes(`${constants_default.YEAR}s`);
24
+ const dateIncludesMonth = dateKeys.includes("M") || dateKeys.includes(constants_default.MONTH) || dateKeys.includes(`${constants_default.MONTH}s`);
25
+ const dateIncludesDay = dateKeys.includes("D") || dateKeys.includes(constants_default.DAY_OF_MONTH) || dateKeys.includes(`${constants_default.DAY_OF_MONTH}s`) || dateKeys.includes("d") || dateKeys.includes(constants_default.DAY) || dateKeys.includes(`${constants_default.DAY}s`);
26
+ if (dateIncludesDay && !dateIncludesMonth && !dateIncludesYear) dateArrayTuple[1] = now.month() + 1;
27
+ for (const stringKey of dateKeys) {
28
+ const key = normalizeUnitWithPlurals(stringKey);
29
+ switch (key) {
30
+ case constants_default.YEAR:
31
+ dateArrayTuple[0] = Number(date[stringKey]);
32
+ break;
33
+ case constants_default.MONTH:
34
+ dateArrayTuple[1] = Number(date[stringKey]) + 1;
35
+ break;
36
+ case constants_default.DAY:
37
+ case constants_default.DAY_OF_MONTH:
38
+ dateArrayTuple[2] = Number(date[stringKey]);
39
+ break;
40
+ case constants_default.HOUR:
41
+ dateArrayTuple[3] = Number(date[stringKey]);
42
+ break;
43
+ case constants_default.MIN:
44
+ dateArrayTuple[4] = Number(date[stringKey]);
45
+ break;
46
+ case constants_default.SECOND:
47
+ dateArrayTuple[5] = Number(date[stringKey]);
48
+ break;
49
+ case constants_default.MS:
50
+ dateArrayTuple[6] = Number(date[stringKey]);
51
+ break;
52
+ }
53
+ }
54
+ this["$d"] = this.dateFromDateComponents(...dateArrayTuple);
55
+ } else oldParse.call(this, date);
56
+ };
57
+ const old$set = proto["$set"];
58
+ proto["$set"] = function(unit, values) {
59
+ if (isObject(unit)) {
60
+ const keys = Object.keys(unit);
61
+ const valuesToSet = unit;
62
+ let result = this;
63
+ for (const stringKey of keys) {
64
+ const key = stringKey;
65
+ const valueToSet = valuesToSet[key];
66
+ result = old$set.call(result, key, [valueToSet]);
67
+ }
68
+ return result;
69
+ }
70
+ return old$set.call(this, unit, values);
71
+ };
72
+ const oldAdd = proto.add;
73
+ proto.add = function(value, unit) {
74
+ if (isObject(value)) {
75
+ const keys = Object.keys(value);
76
+ let result = this;
77
+ for (const stringKey of keys) {
78
+ const key = stringKey;
79
+ const valueToAdd = value[key];
80
+ result = oldAdd.call(result, valueToAdd, key);
81
+ }
82
+ return result;
83
+ }
84
+ return oldAdd.call(this, value, unit);
85
+ };
86
+ const oldSubtract = proto.subtract;
87
+ proto.subtract = function(value, unit) {
88
+ if (isObject(value)) {
89
+ let result = this;
90
+ const keys = Object.keys(value);
91
+ for (const stringKey of keys) {
92
+ const key = stringKey;
93
+ const valueToSubtract = value[key];
94
+ result = oldSubtract.call(result, valueToSubtract, key);
95
+ }
96
+ return result;
97
+ }
98
+ return oldSubtract.call(this, value, unit);
99
+ };
100
+ };
101
+ var objectSupport_default = objectSupportPlugin;
102
+
103
+ //#endregion
104
+ export { objectSupport_default as default };
@@ -0,0 +1,20 @@
1
+ import { EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
+ import "../../chunks/MtjcOKi-.js";
3
+
4
+ //#region src/plugins/pluralGetSet/index.d.ts
5
+
6
+ declare module 'esday' {
7
+ interface EsDay {
8
+ years: (() => number) & ((year: number, month?: number, date?: number) => EsDay);
9
+ months: (() => number) & ((month: number, date?: number) => EsDay);
10
+ dates: (() => number) & ((date: number) => EsDay);
11
+ days: (() => number) & ((day: number) => EsDay);
12
+ hours: (() => number) & ((hours: number, min?: number, sec?: number, ms?: number) => EsDay);
13
+ minutes: (() => number) & ((min: number, sec?: number, ms?: number) => EsDay);
14
+ seconds: (() => number) & ((sec: number, ms?: number) => EsDay);
15
+ milliseconds: (() => number) & ((ms: number) => EsDay);
16
+ }
17
+ }
18
+ declare const pluralGetSetPlugin: EsDayPlugin<{}>;
19
+ //#endregion
20
+ export { pluralGetSetPlugin as default };
@@ -0,0 +1,16 @@
1
+ //#region src/plugins/pluralGetSet/index.ts
2
+ const pluralGetSetPlugin = (_, dayClass, _dayFactory) => {
3
+ const proto = dayClass.prototype;
4
+ proto.years = proto.year;
5
+ proto.months = proto.month;
6
+ proto.dates = proto.date;
7
+ proto.days = proto.day;
8
+ proto.hours = proto.hour;
9
+ proto.minutes = proto.minute;
10
+ proto.seconds = proto.second;
11
+ proto.milliseconds = proto.millisecond;
12
+ };
13
+ var pluralGetSet_default = pluralGetSetPlugin;
14
+
15
+ //#endregion
16
+ export { pluralGetSet_default as default };
@@ -0,0 +1,16 @@
1
+ import { EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
+ import "../../chunks/MtjcOKi-.js";
3
+
4
+ //#region src/plugins/quarterOfYear/index.d.ts
5
+
6
+ declare module 'esday' {
7
+ interface EsDay {
8
+ quarter(): number;
9
+ quarter(quarterNumber: number): EsDay;
10
+ quarters(): number;
11
+ quarters(quarterNumber: number): EsDay;
12
+ }
13
+ }
14
+ declare const quarterOfYearPlugin: EsDayPlugin<{}>;
15
+ //#endregion
16
+ export { quarterOfYearPlugin as default };
@@ -0,0 +1,58 @@
1
+ import { constants_default } from "../../chunks/Y32qdU_5.js";
2
+ import { isObject } from "../../chunks/Cb5SvF6r.js";
3
+ import { normalizeUnitWithPlurals } from "../../chunks/DjY7KvwG.js";
4
+
5
+ //#region src/plugins/quarterOfYear/index.ts
6
+ const quarterOfYearPlugin = (_, dayClass, dayFactory) => {
7
+ const proto = dayClass.prototype;
8
+ proto.quarter = function(quarterNumber) {
9
+ if (quarterNumber === void 0) return Math.ceil((this.month() + 1) / 3);
10
+ return this.month(this.month() % 3 + (quarterNumber - 1) * 3);
11
+ };
12
+ proto.quarters = proto.quarter;
13
+ const oldAdd = proto.add;
14
+ proto.add = function(value, unit) {
15
+ if (!isObject(value) && unit !== void 0) {
16
+ const unitLong = normalizeUnitWithPlurals(unit);
17
+ if (unitLong === constants_default.QUARTER) return this.add(value * 3, constants_default.MONTH);
18
+ }
19
+ return oldAdd.call(this, value, unit);
20
+ };
21
+ const oldStartOf = proto.startOf;
22
+ proto.startOf = function(units) {
23
+ const unit = normalizeUnitWithPlurals(units);
24
+ if (unit === constants_default.QUARTER) {
25
+ const quarter = this.quarter() - 1;
26
+ return this.month(quarter * 3).startOf(constants_default.MONTH).startOf(constants_default.DAY);
27
+ }
28
+ return oldStartOf.call(this, units);
29
+ };
30
+ const oldEndOf = proto.endOf;
31
+ proto.endOf = function(units) {
32
+ const unit = normalizeUnitWithPlurals(units);
33
+ if (unit === constants_default.QUARTER) {
34
+ const quarter = this.quarter() - 1;
35
+ return this.month(quarter * 3 + 2).endOf(constants_default.MONTH).endOf(constants_default.DAY);
36
+ }
37
+ return oldEndOf.call(this, units);
38
+ };
39
+ const oldGet = proto.get;
40
+ proto.get = function(unit) {
41
+ const normalizedUnit = normalizeUnitWithPlurals(unit);
42
+ if (normalizedUnit === constants_default.QUARTER) return this.quarter();
43
+ return oldGet.call(this, unit);
44
+ };
45
+ const old$set = proto["$set"];
46
+ proto["$set"] = function(unit, values) {
47
+ if (isObject(unit)) return this.clone();
48
+ const normalizedUnit = normalizeUnitWithPlurals(unit);
49
+ if (normalizedUnit === constants_default.QUARTER) return this.quarter(values[0]);
50
+ return old$set.call(this, unit, values);
51
+ };
52
+ const additionalTokens = { Q: (sourceDate) => sourceDate.quarter().toString() };
53
+ dayFactory.addFormatTokenDefinitions(additionalTokens);
54
+ };
55
+ var quarterOfYear_default = quarterOfYearPlugin;
56
+
57
+ //#endregion
58
+ export { quarterOfYear_default as default };
@@ -0,0 +1,59 @@
1
+ import { DateType, EsDayPlugin } from "../../chunks/DqhiVwLi.js";
2
+ import "../../chunks/MtjcOKi-.js";
3
+ import { RelativeTimeKeys } from "../../chunks/St35qgL0.js";
4
+
5
+ //#region src/common/constants.d.ts
6
+
7
+ declare const _default: {
8
+ SECONDS_A_MINUTE: number;
9
+ SECONDS_A_HOUR: number;
10
+ SECONDS_A_DAY: number;
11
+ SECONDS_A_WEEK: number;
12
+ MILLISECONDS_A_SECOND: number;
13
+ MILLISECONDS_A_MINUTE: number;
14
+ MILLISECONDS_A_HOUR: number;
15
+ MILLISECONDS_A_DAY: number;
16
+ MILLISECONDS_A_WEEK: number;
17
+ INDEX_SUNDAY: number;
18
+ INDEX_MONDAY: number;
19
+ INDEX_WEDNESDAY: number;
20
+ INDEX_THURSDAY: number;
21
+ MS: "millisecond";
22
+ SECOND: "second";
23
+ MIN: "minute";
24
+ HOUR: "hour";
25
+ DAY: "day";
26
+ WEEK: "week";
27
+ ISOWEEK: "isoWeek";
28
+ MONTH: "month";
29
+ QUARTER: "quarter";
30
+ YEAR: "year";
31
+ DAY_OF_MONTH: "date";
32
+ FORMAT_DEFAULT: string;
33
+ INVALID_DATE: Date;
34
+ INVALID_DATE_STRING: string;
35
+ REGEX_PARSE_DEFAULT: RegExp;
36
+ };
37
+ //#endregion
38
+ //#region src/plugins/relativeTime/index.d.ts
39
+
40
+ declare module 'esday' {
41
+ interface EsDay {
42
+ to: (referenceDate: DateType, withoutSuffix?: boolean) => string;
43
+ from: (referenceDate: DateType, withoutSuffix?: boolean) => string;
44
+ toNow: (withoutSuffix?: boolean) => string;
45
+ fromNow: (withoutSuffix?: boolean) => string;
46
+ }
47
+ }
48
+ type ThresholdUnit = typeof _default.SECOND | typeof _default.MIN | typeof _default.HOUR | typeof _default.DAY | typeof _default.MONTH | typeof _default.YEAR;
49
+ type Threshold = {
50
+ key: RelativeTimeKeys;
51
+ thresholdValue?: number;
52
+ thresholdUnit?: ThresholdUnit;
53
+ };
54
+ declare const relativeTimePlugin: EsDayPlugin<{
55
+ thresholds?: Threshold[];
56
+ rounding?: (valueToRound: number) => number;
57
+ }>;
58
+ //#endregion
59
+ export { Threshold, ThresholdUnit, relativeTimePlugin as default };
@@ -0,0 +1,154 @@
1
+ import { constants_default } from "../../chunks/Y32qdU_5.js";
2
+ import { createInstanceFromExist } from "../../chunks/DXHbH1CI.js";
3
+
4
+ //#region src/plugins/relativeTime/index.ts
5
+ const relativeTimePlugin = (options, dayClass, dayFactory) => {
6
+ const proto = dayClass.prototype;
7
+ const defaultRelativeTimeDef = {
8
+ future: "in %s",
9
+ past: "%s ago",
10
+ s: "a few seconds",
11
+ ss: "%d seconds",
12
+ m: "a minute",
13
+ mm: "%d minutes",
14
+ h: "an hour",
15
+ hh: "%d hours",
16
+ d: "a day",
17
+ dd: "%d days",
18
+ M: "a month",
19
+ MM: "%d months",
20
+ y: "a year",
21
+ yy: "%d years"
22
+ };
23
+ const thresholds = options.thresholds ?? [
24
+ {
25
+ key: "s",
26
+ thresholdValue: 44,
27
+ thresholdUnit: constants_default.SECOND
28
+ },
29
+ {
30
+ key: "ss",
31
+ thresholdValue: 43,
32
+ thresholdUnit: constants_default.SECOND
33
+ },
34
+ {
35
+ key: "m",
36
+ thresholdValue: 89,
37
+ thresholdUnit: constants_default.SECOND
38
+ },
39
+ {
40
+ key: "mm",
41
+ thresholdValue: 44,
42
+ thresholdUnit: constants_default.MIN
43
+ },
44
+ {
45
+ key: "h",
46
+ thresholdValue: 89,
47
+ thresholdUnit: constants_default.MIN
48
+ },
49
+ {
50
+ key: "hh",
51
+ thresholdValue: 21,
52
+ thresholdUnit: constants_default.HOUR
53
+ },
54
+ {
55
+ key: "d",
56
+ thresholdValue: 35,
57
+ thresholdUnit: constants_default.HOUR
58
+ },
59
+ {
60
+ key: "dd",
61
+ thresholdValue: 25,
62
+ thresholdUnit: constants_default.DAY
63
+ },
64
+ {
65
+ key: "M",
66
+ thresholdValue: 45,
67
+ thresholdUnit: constants_default.DAY
68
+ },
69
+ {
70
+ key: "MM",
71
+ thresholdValue: 10,
72
+ thresholdUnit: constants_default.MONTH
73
+ },
74
+ {
75
+ key: "y",
76
+ thresholdValue: 17,
77
+ thresholdUnit: constants_default.MONTH
78
+ },
79
+ {
80
+ key: "yy",
81
+ thresholdUnit: constants_default.YEAR
82
+ }
83
+ ];
84
+ const rounding = options.rounding ?? Math.round;
85
+ /**
86
+ * Calculate the difference between instance and referenceDate in given units
87
+ * as fractional value for 'from' and 'to'
88
+ * @param instance - date to calculate difference for
89
+ * @param referenceDate - base date for calculating the difference
90
+ * @param unit - unit of the difference
91
+ * @param isFrom - difference for 'from'?
92
+ * @returns difference as float
93
+ */
94
+ function differenceInUnits(instance, referenceDate, unit, isFrom) {
95
+ return isFrom ? referenceDate.diff(instance, unit, true) : instance.diff(referenceDate, unit, true);
96
+ }
97
+ /**
98
+ * Format instance date as relative to reference date as
99
+ * human readable length of time.
100
+ * @param reference - date the output relates to
101
+ * @param withoutSuffix - format without 'in ---' or '... ago'
102
+ * @param this - date to format
103
+ * @param isFrom - format as 'from' or 'fromNow'
104
+ * @returns difference formatted as human string (e.g. 5 days ago)
105
+ */
106
+ function fromToBase(reference, withoutSuffix, isFrom) {
107
+ const referenceDate = dayFactory(reference);
108
+ if (!(this.isValid() && referenceDate.isValid())) return constants_default.INVALID_DATE_STRING;
109
+ const locale = this.localeObject?.();
110
+ const relativeTimeDef = locale?.relativeTime ?? defaultRelativeTimeDef;
111
+ let diffAsUnit = 0;
112
+ let out = "";
113
+ let isFuture = false;
114
+ for (let i = 0; i < thresholds.length; i++) {
115
+ const threshold = thresholds[i];
116
+ const thresholdUnit = threshold.thresholdUnit ?? constants_default.SECOND;
117
+ diffAsUnit = differenceInUnits(this, referenceDate, thresholdUnit, isFrom);
118
+ const absoluteDiff = rounding(Math.abs(diffAsUnit));
119
+ isFuture = diffAsUnit > 0;
120
+ if (absoluteDiff <= (threshold.thresholdValue ?? Number.POSITIVE_INFINITY)) {
121
+ const thresholdKey = threshold.key;
122
+ const formatUnit = thresholdKey.slice(0, 1);
123
+ const outputDiff = differenceInUnits(this, referenceDate, formatUnit, isFrom);
124
+ const outputDiffAbs = rounding(Math.abs(outputDiff));
125
+ const format = relativeTimeDef[thresholdKey];
126
+ out = typeof format === "string" ? format.replace("%d", `${outputDiffAbs}`) : format(outputDiffAbs, withoutSuffix, thresholdKey, isFuture);
127
+ const postFormat = locale?.postFormat;
128
+ if (postFormat) out = postFormat(out);
129
+ break;
130
+ }
131
+ }
132
+ if (withoutSuffix) return out;
133
+ const suffix = isFuture ? relativeTimeDef.future : relativeTimeDef.past;
134
+ return typeof suffix === "function" ? suffix(out, withoutSuffix, isFuture ? "future" : "past", isFuture) : suffix.replace("%s", out);
135
+ }
136
+ proto.to = function(referenceDate, withoutSuffix) {
137
+ return fromToBase.call(this, referenceDate, withoutSuffix ?? false, true);
138
+ };
139
+ proto.from = function(referenceDate, withoutSuffix) {
140
+ return fromToBase.call(this, referenceDate, withoutSuffix ?? false, false);
141
+ };
142
+ proto.toNow = function(withoutSuffix) {
143
+ const now = createInstanceFromExist(/* @__PURE__ */ new Date(), this);
144
+ return this.to(now, withoutSuffix);
145
+ };
146
+ proto.fromNow = function(withoutSuffix) {
147
+ const now = createInstanceFromExist(/* @__PURE__ */ new Date(), this);
148
+ return this.from(now, withoutSuffix);
149
+ };
150
+ };
151
+ var relativeTime_default = relativeTimePlugin;
152
+
153
+ //#endregion
154
+ export { relativeTime_default as default };