javascript-time-ago 2.3.7 → 2.3.11
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.
- package/README.md +22 -12
- package/bin/generate-locale-messages.js +5 -1
- package/bundle/javascript-time-ago.js +1 -1
- package/bundle/javascript-time-ago.js.map +1 -1
- package/bundle/javascript-time-ago.min.js +1 -1
- package/bundle/javascript-time-ago.min.js.map +1 -1
- package/commonjs/TimeAgo.js +2 -2
- package/commonjs/TimeAgo.js.map +1 -1
- package/commonjs/TimeAgo.test.js +6 -6
- package/commonjs/TimeAgo.test.js.map +1 -1
- package/index.d.ts +130 -0
- package/load-all-locales.js +34 -0
- package/locale/af/index.js +3 -1
- package/locale/af.json +18 -18
- package/locale/am/index.js +3 -1
- package/locale/ar/index.js +3 -1
- package/locale/ar-AE/index.js +3 -1
- package/locale/as/index.js +3 -1
- package/locale/as.json +2 -2
- package/locale/ast/index.js +3 -1
- package/locale/az/index.js +3 -1
- package/locale/be/index.js +3 -1
- package/locale/be.json +16 -16
- package/locale/bg/index.js +3 -1
- package/locale/bg.json +1 -1
- package/locale/bn/index.js +3 -1
- package/locale/br/index.js +3 -1
- package/locale/br.json +16 -28
- package/locale/bs/index.js +3 -1
- package/locale/bs-Cyrl/index.js +3 -1
- package/locale/bs-Cyrl.json +105 -140
- package/locale/ca/index.js +3 -1
- package/locale/ca.json +4 -4
- package/locale/ccp/index.js +3 -1
- package/locale/ce/index.js +3 -1
- package/locale/ceb/index.js +3 -0
- package/locale/ceb.json +159 -0
- package/locale/chr/index.js +3 -1
- package/locale/chr.json +18 -18
- package/locale/cs/index.js +3 -1
- package/locale/cy/index.js +3 -1
- package/locale/cy.json +85 -30
- package/locale/da/index.js +3 -1
- package/locale/da.json +30 -30
- package/locale/de/index.js +3 -1
- package/locale/dsb/index.js +3 -1
- package/locale/dz/index.js +3 -1
- package/locale/ee/index.js +3 -1
- package/locale/el/index.js +3 -1
- package/locale/el.json +19 -9
- package/locale/en/index.js +3 -1
- package/locale/en-001/index.js +3 -1
- package/locale/en-001.json +18 -18
- package/locale/en-150/index.js +3 -1
- package/locale/en-150.json +18 -18
- package/locale/en-AG/index.js +3 -1
- package/locale/en-AG.json +18 -18
- package/locale/en-AI/index.js +3 -1
- package/locale/en-AI.json +18 -18
- package/locale/en-AT/index.js +3 -1
- package/locale/en-AT.json +18 -18
- package/locale/en-AU/index.js +3 -1
- package/locale/en-AU.json +18 -18
- package/locale/en-BB/index.js +3 -1
- package/locale/en-BB.json +18 -18
- package/locale/en-BE/index.js +3 -1
- package/locale/en-BE.json +18 -18
- package/locale/en-BM/index.js +3 -1
- package/locale/en-BM.json +18 -18
- package/locale/en-BS/index.js +3 -1
- package/locale/en-BS.json +18 -18
- package/locale/en-BW/index.js +3 -1
- package/locale/en-BW.json +18 -18
- package/locale/en-BZ/index.js +3 -1
- package/locale/en-BZ.json +18 -18
- package/locale/en-CA/index.js +3 -1
- package/locale/en-CA.json +18 -18
- package/locale/en-CC/index.js +3 -1
- package/locale/en-CC.json +18 -18
- package/locale/en-CH/index.js +3 -1
- package/locale/en-CH.json +18 -18
- package/locale/en-CK/index.js +3 -1
- package/locale/en-CK.json +18 -18
- package/locale/en-CM/index.js +3 -1
- package/locale/en-CM.json +18 -18
- package/locale/en-CX/index.js +3 -1
- package/locale/en-CX.json +18 -18
- package/locale/en-CY/index.js +3 -1
- package/locale/en-CY.json +18 -18
- package/locale/en-DE/index.js +3 -1
- package/locale/en-DE.json +18 -18
- package/locale/en-DG/index.js +3 -1
- package/locale/en-DG.json +18 -18
- package/locale/en-DK/index.js +3 -1
- package/locale/en-DK.json +18 -18
- package/locale/en-DM/index.js +3 -1
- package/locale/en-DM.json +18 -18
- package/locale/en-ER/index.js +3 -1
- package/locale/en-ER.json +18 -18
- package/locale/en-FI/index.js +3 -1
- package/locale/en-FI.json +18 -18
- package/locale/en-FJ/index.js +3 -1
- package/locale/en-FJ.json +18 -18
- package/locale/en-FK/index.js +3 -1
- package/locale/en-FK.json +18 -18
- package/locale/en-FM/index.js +3 -1
- package/locale/en-FM.json +18 -18
- package/locale/en-GB/index.js +3 -1
- package/locale/en-GB.json +18 -18
- package/locale/en-GD/index.js +3 -1
- package/locale/en-GD.json +18 -18
- package/locale/en-GG/index.js +3 -1
- package/locale/en-GG.json +18 -18
- package/locale/en-GH/index.js +3 -1
- package/locale/en-GH.json +18 -18
- package/locale/en-GI/index.js +3 -1
- package/locale/en-GI.json +18 -18
- package/locale/en-GM/index.js +3 -1
- package/locale/en-GM.json +18 -18
- package/locale/en-GY/index.js +3 -1
- package/locale/en-GY.json +18 -18
- package/locale/en-HK/index.js +3 -1
- package/locale/en-HK.json +18 -18
- package/locale/en-IE/index.js +3 -1
- package/locale/en-IE.json +18 -18
- package/locale/en-IL/index.js +3 -1
- package/locale/en-IL.json +18 -18
- package/locale/en-IM/index.js +3 -1
- package/locale/en-IM.json +18 -18
- package/locale/en-IN/index.js +3 -1
- package/locale/en-IN.json +18 -18
- package/locale/en-IO/index.js +3 -1
- package/locale/en-IO.json +18 -18
- package/locale/en-JE/index.js +3 -1
- package/locale/en-JE.json +18 -18
- package/locale/en-JM/index.js +3 -1
- package/locale/en-JM.json +18 -18
- package/locale/en-KE/index.js +3 -1
- package/locale/en-KE.json +18 -18
- package/locale/en-KI/index.js +3 -1
- package/locale/en-KI.json +18 -18
- package/locale/en-KN/index.js +3 -1
- package/locale/en-KN.json +18 -18
- package/locale/en-KY/index.js +3 -1
- package/locale/en-KY.json +18 -18
- package/locale/en-LC/index.js +3 -1
- package/locale/en-LC.json +18 -18
- package/locale/en-LR/index.js +3 -1
- package/locale/en-LR.json +18 -18
- package/locale/en-LS/index.js +3 -1
- package/locale/en-LS.json +18 -18
- package/locale/en-MG/index.js +3 -1
- package/locale/en-MG.json +18 -18
- package/locale/en-MO/index.js +3 -1
- package/locale/en-MO.json +18 -18
- package/locale/en-MS/index.js +3 -1
- package/locale/en-MS.json +18 -18
- package/locale/en-MT/index.js +3 -1
- package/locale/en-MT.json +18 -18
- package/locale/en-MU/index.js +3 -1
- package/locale/en-MU.json +18 -18
- package/locale/en-MW/index.js +3 -1
- package/locale/en-MW.json +18 -18
- package/locale/en-MY/index.js +3 -1
- package/locale/en-MY.json +18 -18
- package/locale/en-NA/index.js +3 -1
- package/locale/en-NA.json +18 -18
- package/locale/en-NF/index.js +3 -1
- package/locale/en-NF.json +18 -18
- package/locale/en-NG/index.js +3 -1
- package/locale/en-NG.json +18 -18
- package/locale/en-NL/index.js +3 -1
- package/locale/en-NL.json +18 -18
- package/locale/en-NR/index.js +3 -1
- package/locale/en-NR.json +18 -18
- package/locale/en-NU/index.js +3 -1
- package/locale/en-NU.json +18 -18
- package/locale/en-NZ/index.js +3 -1
- package/locale/en-NZ.json +18 -18
- package/locale/en-PG/index.js +3 -1
- package/locale/en-PG.json +18 -18
- package/locale/en-PH/index.js +3 -1
- package/locale/en-PH.json +18 -18
- package/locale/en-PK/index.js +3 -1
- package/locale/en-PK.json +18 -18
- package/locale/en-PN/index.js +3 -1
- package/locale/en-PN.json +18 -18
- package/locale/en-PW/index.js +3 -1
- package/locale/en-PW.json +18 -18
- package/locale/en-RW/index.js +3 -1
- package/locale/en-RW.json +18 -18
- package/locale/en-SB/index.js +3 -1
- package/locale/en-SB.json +18 -18
- package/locale/en-SC/index.js +3 -1
- package/locale/en-SC.json +18 -18
- package/locale/en-SD/index.js +3 -1
- package/locale/en-SD.json +18 -18
- package/locale/en-SE/index.js +3 -1
- package/locale/en-SE.json +18 -18
- package/locale/en-SG/index.js +3 -1
- package/locale/en-SG.json +3 -3
- package/locale/en-SH/index.js +3 -1
- package/locale/en-SH.json +18 -18
- package/locale/en-SI/index.js +3 -1
- package/locale/en-SI.json +18 -18
- package/locale/en-SL/index.js +3 -1
- package/locale/en-SL.json +18 -18
- package/locale/en-SS/index.js +3 -1
- package/locale/en-SS.json +18 -18
- package/locale/en-SX/index.js +3 -1
- package/locale/en-SX.json +18 -18
- package/locale/en-SZ/index.js +3 -1
- package/locale/en-SZ.json +18 -18
- package/locale/en-TC/index.js +3 -1
- package/locale/en-TC.json +18 -18
- package/locale/en-TK/index.js +3 -1
- package/locale/en-TK.json +18 -18
- package/locale/en-TO/index.js +3 -1
- package/locale/en-TO.json +18 -18
- package/locale/en-TT/index.js +3 -1
- package/locale/en-TT.json +18 -18
- package/locale/en-TV/index.js +3 -1
- package/locale/en-TV.json +18 -18
- package/locale/en-TZ/index.js +3 -1
- package/locale/en-TZ.json +18 -18
- package/locale/en-UG/index.js +3 -1
- package/locale/en-UG.json +18 -18
- package/locale/en-VC/index.js +3 -1
- package/locale/en-VC.json +18 -18
- package/locale/en-VG/index.js +3 -1
- package/locale/en-VG.json +18 -18
- package/locale/en-VU/index.js +3 -1
- package/locale/en-VU.json +18 -18
- package/locale/en-WS/index.js +3 -1
- package/locale/en-WS.json +18 -18
- package/locale/en-ZA/index.js +3 -1
- package/locale/en-ZA.json +18 -18
- package/locale/en-ZM/index.js +3 -1
- package/locale/en-ZM.json +18 -18
- package/locale/en-ZW/index.js +3 -1
- package/locale/en-ZW.json +18 -18
- package/locale/en.json +27 -17
- package/locale/es/index.js +3 -1
- package/locale/es-419/index.js +3 -0
- package/locale/es-419.json +225 -0
- package/locale/es-AR/index.js +3 -1
- package/locale/es-AR.json +6 -6
- package/locale/es-BO/index.js +3 -0
- package/locale/es-BO.json +225 -0
- package/locale/es-BR/index.js +3 -0
- package/locale/es-BR.json +225 -0
- package/locale/es-BZ/index.js +3 -0
- package/locale/es-BZ.json +225 -0
- package/locale/es-CL/index.js +3 -0
- package/locale/es-CL.json +225 -0
- package/locale/es-CO/index.js +3 -0
- package/locale/es-CO.json +225 -0
- package/locale/es-CR/index.js +3 -0
- package/locale/es-CR.json +225 -0
- package/locale/es-CU/index.js +3 -0
- package/locale/es-CU.json +225 -0
- package/locale/es-DO/index.js +3 -0
- package/locale/es-DO.json +225 -0
- package/locale/es-EC/index.js +3 -0
- package/locale/es-EC.json +225 -0
- package/locale/es-GT/index.js +3 -0
- package/locale/es-GT.json +225 -0
- package/locale/es-HN/index.js +3 -0
- package/locale/es-HN.json +225 -0
- package/locale/es-MX/index.js +3 -1
- package/locale/es-MX.json +18 -18
- package/locale/es-NI/index.js +3 -0
- package/locale/es-NI.json +225 -0
- package/locale/es-PA/index.js +3 -0
- package/locale/es-PA.json +225 -0
- package/locale/es-PE/index.js +3 -0
- package/locale/es-PE.json +225 -0
- package/locale/es-PR/index.js +3 -0
- package/locale/es-PR.json +225 -0
- package/locale/es-PY/index.js +3 -1
- package/locale/es-PY.json +6 -6
- package/locale/es-SV/index.js +3 -1
- package/locale/es-SV.json +6 -6
- package/locale/es-US/index.js +3 -1
- package/locale/es-US.json +6 -6
- package/locale/es-UY/index.js +3 -0
- package/locale/es-UY.json +225 -0
- package/locale/es-VE/index.js +3 -0
- package/locale/es-VE.json +225 -0
- package/locale/es.json +16 -6
- package/locale/et/index.js +3 -1
- package/locale/et.json +18 -18
- package/locale/eu/index.js +3 -1
- package/locale/fa/index.js +3 -1
- package/locale/fa.json +2 -2
- package/locale/ff-Adlm/index.js +3 -0
- package/locale/ff-Adlm.json +279 -0
- package/locale/fi/index.js +3 -1
- package/locale/fil/index.js +3 -1
- package/locale/fo/index.js +3 -1
- package/locale/fo.json +12 -12
- package/locale/fr/index.js +3 -1
- package/locale/fr-CA/index.js +3 -1
- package/locale/fr-CA.json +4 -4
- package/locale/fur/index.js +3 -1
- package/locale/fy/index.js +3 -1
- package/locale/ga/index.js +3 -1
- package/locale/ga.json +3 -5
- package/locale/gd/index.js +3 -1
- package/locale/gd.json +4 -4
- package/locale/gl/index.js +3 -1
- package/locale/gl.json +14 -14
- package/locale/gu/index.js +3 -1
- package/locale/ha/index.js +3 -0
- package/locale/ha.json +222 -0
- package/locale/he/index.js +3 -1
- package/locale/hi/index.js +3 -1
- package/locale/hi.json +9 -15
- package/locale/hr/index.js +3 -1
- package/locale/hsb/index.js +3 -1
- package/locale/hu/index.js +3 -1
- package/locale/hy/index.js +3 -1
- package/locale/hy.json +3 -3
- package/locale/ia/index.js +3 -1
- package/locale/ia.json +132 -48
- package/locale/id/index.js +3 -1
- package/locale/id.json +18 -18
- package/locale/ig/index.js +3 -0
- package/locale/ig.json +159 -0
- package/locale/is/index.js +3 -1
- package/locale/it/index.js +3 -1
- package/locale/it.json +8 -14
- package/locale/ja/index.js +3 -1
- package/locale/ja.json +9 -9
- package/locale/jgo/index.js +3 -1
- package/locale/jv/index.js +3 -1
- package/locale/jv.json +69 -69
- package/locale/ka/index.js +3 -1
- package/locale/kea/index.js +3 -1
- package/locale/kea.json +21 -21
- package/locale/kk/index.js +3 -1
- package/locale/kl/index.js +3 -1
- package/locale/km/index.js +3 -1
- package/locale/kn/index.js +3 -1
- package/locale/ko/index.js +3 -1
- package/locale/ko.json +11 -0
- package/locale/kok/index.js +3 -1
- package/locale/kok.json +1 -1
- package/locale/ksh/index.js +3 -1
- package/locale/ku/index.js +3 -1
- package/locale/ku.json +44 -26
- package/locale/ky/index.js +3 -1
- package/locale/lb/index.js +3 -1
- package/locale/lkt/index.js +3 -1
- package/locale/lo/index.js +3 -1
- package/locale/lo.json +1 -1
- package/locale/lt/index.js +3 -1
- package/locale/lv/index.js +3 -1
- package/locale/lv.json +18 -18
- package/locale/mk/index.js +3 -1
- package/locale/mk.json +6 -6
- package/locale/ml/index.js +3 -1
- package/locale/mn/index.js +3 -1
- package/locale/mn.json +6 -6
- package/locale/mr/index.js +3 -1
- package/locale/ms/index.js +3 -1
- package/locale/ms.json +7 -7
- package/locale/mt/index.js +3 -1
- package/locale/my/index.js +3 -1
- package/locale/mzn/index.js +3 -1
- package/locale/nb/index.js +3 -1
- package/locale/ne/index.js +3 -1
- package/locale/ne.json +4 -4
- package/locale/nl/index.js +3 -1
- package/locale/nn/index.js +3 -1
- package/locale/nn.json +26 -26
- package/locale/no/index.js +3 -0
- package/locale/no.json +201 -0
- package/locale/or/index.js +3 -1
- package/locale/or.json +5 -5
- package/locale/pa/index.js +3 -1
- package/locale/pcm/index.js +3 -0
- package/locale/pcm.json +159 -0
- package/locale/pl/index.js +3 -1
- package/locale/pl.json +14 -14
- package/locale/ps/index.js +3 -1
- package/locale/ps-PK/index.js +3 -0
- package/locale/ps-PK.json +240 -0
- package/locale/ps.json +157 -94
- package/locale/pt/index.js +3 -1
- package/locale/pt-AO/index.js +3 -1
- package/locale/pt-AO.json +4 -1
- package/locale/pt-CH/index.js +3 -1
- package/locale/pt-CH.json +4 -1
- package/locale/pt-CV/index.js +3 -1
- package/locale/pt-CV.json +4 -1
- package/locale/pt-GQ/index.js +3 -1
- package/locale/pt-GQ.json +4 -1
- package/locale/pt-GW/index.js +3 -1
- package/locale/pt-GW.json +4 -1
- package/locale/pt-LU/index.js +3 -1
- package/locale/pt-LU.json +4 -1
- package/locale/pt-MO/index.js +3 -1
- package/locale/pt-MO.json +4 -1
- package/locale/pt-MZ/index.js +3 -1
- package/locale/pt-MZ.json +4 -1
- package/locale/pt-PT/index.js +3 -1
- package/locale/pt-PT.json +4 -1
- package/locale/pt-ST/index.js +3 -1
- package/locale/pt-ST.json +4 -1
- package/locale/pt-TL/index.js +3 -1
- package/locale/pt-TL.json +4 -1
- package/locale/pt.json +2 -5
- package/locale/qu/index.js +3 -1
- package/locale/rm/index.js +3 -0
- package/locale/rm.json +165 -0
- package/locale/ro/index.js +3 -1
- package/locale/ro.json +1 -1
- package/locale/ru/index.js +3 -1
- package/locale/ru.json +36 -39
- package/locale/sah/index.js +3 -1
- package/locale/sd/index.js +3 -1
- package/locale/sd.json +6 -6
- package/locale/se/index.js +3 -1
- package/locale/se-FI/index.js +3 -1
- package/locale/si/index.js +3 -1
- package/locale/sk/index.js +3 -1
- package/locale/sl/index.js +3 -1
- package/locale/so/index.js +3 -1
- package/locale/so.json +137 -83
- package/locale/sq/index.js +3 -1
- package/locale/sr/index.js +3 -1
- package/locale/sr-Cyrl-BA/index.js +3 -0
- package/locale/sr-Cyrl-BA.json +214 -0
- package/locale/sr-Latn/index.js +3 -1
- package/locale/sr-Latn-BA/index.js +3 -0
- package/locale/sr-Latn-BA.json +214 -0
- package/locale/su/index.js +3 -0
- package/locale/su.json +159 -0
- package/locale/sv/index.js +3 -1
- package/locale/sw/index.js +3 -1
- package/locale/ta/index.js +3 -1
- package/locale/te/index.js +3 -1
- package/locale/te.json +6 -6
- package/locale/tg/index.js +3 -0
- package/locale/tg.json +159 -0
- package/locale/th/index.js +3 -1
- package/locale/ti/index.js +3 -1
- package/locale/ti.json +2 -2
- package/locale/tk/index.js +3 -1
- package/locale/to/index.js +3 -1
- package/locale/to.json +6 -6
- package/locale/tr/index.js +3 -1
- package/locale/tr.json +12 -12
- package/locale/tt/index.js +3 -0
- package/locale/tt.json +159 -0
- package/locale/ug/index.js +3 -1
- package/locale/uk/index.js +3 -1
- package/locale/uk.json +9 -9
- package/locale/ur/index.js +3 -1
- package/locale/ur-IN/index.js +3 -1
- package/locale/ur-IN.json +4 -7
- package/locale/ur.json +8 -11
- package/locale/uz/index.js +3 -1
- package/locale/uz-Cyrl/index.js +3 -1
- package/locale/uz.json +6 -6
- package/locale/vi/index.js +3 -1
- package/locale/vi.json +6 -6
- package/locale/wae/index.js +3 -1
- package/locale/wo/index.js +3 -0
- package/locale/wo.json +159 -0
- package/locale/yi/index.js +3 -1
- package/locale/yo/index.js +3 -0
- package/locale/yo-BJ/index.js +3 -0
- package/locale/yo-BJ.json +165 -0
- package/locale/yo.json +165 -0
- package/locale/yue/index.js +3 -1
- package/locale/yue-Hans/index.js +3 -1
- package/locale/zh/index.js +3 -1
- package/locale/zh-Hans-HK/index.js +3 -1
- package/locale/zh-Hans-MO/index.js +3 -1
- package/locale/zh-Hans-SG/index.js +3 -1
- package/locale/zh-Hant/index.js +3 -1
- package/locale/zh-Hant-HK/index.js +3 -1
- package/locale/zh-Hant-MO/index.js +3 -1
- package/locale/zu/index.js +3 -1
- package/locale-more-styles/hi/mini.json +2 -8
- package/locale-more-styles/ru/mini.json +2 -8
- package/modules/TimeAgo.js +2 -2
- package/modules/TimeAgo.js.map +1 -1
- package/modules/TimeAgo.test.js +6 -6
- package/modules/TimeAgo.test.js.map +1 -1
- package/package.json +5 -5
- package/index.d.ts.test +0 -47
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "yo-BJ",
|
|
3
|
+
"long": {
|
|
4
|
+
"year": {
|
|
5
|
+
"previous": "Èshín",
|
|
6
|
+
"current": "Ɔdúnǹí",
|
|
7
|
+
"next": "Àmɔ́dún",
|
|
8
|
+
"past": "-{0} y",
|
|
9
|
+
"future": "+{0} y"
|
|
10
|
+
},
|
|
11
|
+
"quarter": {
|
|
12
|
+
"previous": "last quarter",
|
|
13
|
+
"current": "this quarter",
|
|
14
|
+
"next": "next quarter",
|
|
15
|
+
"past": "-{0} Q",
|
|
16
|
+
"future": "+{0} Q"
|
|
17
|
+
},
|
|
18
|
+
"month": {
|
|
19
|
+
"previous": "óshù tó kɔjá",
|
|
20
|
+
"current": "oshù yìí",
|
|
21
|
+
"next": "óshù tó ń bɔ̀,",
|
|
22
|
+
"past": "-{0} m",
|
|
23
|
+
"future": "+{0} m"
|
|
24
|
+
},
|
|
25
|
+
"week": {
|
|
26
|
+
"previous": "ɔ̀sɛ̀ tó kɔjá",
|
|
27
|
+
"current": "ɔ̀sɛ̀ yìí",
|
|
28
|
+
"next": "ɔ́sɛ̀ tó ń bɔ̀",
|
|
29
|
+
"past": "-{0} w",
|
|
30
|
+
"future": "+{0} w"
|
|
31
|
+
},
|
|
32
|
+
"day": {
|
|
33
|
+
"previous": "Àná",
|
|
34
|
+
"previous-2": "íjɛta",
|
|
35
|
+
"current": "Òní",
|
|
36
|
+
"next": "Ɔ̀la",
|
|
37
|
+
"next-2": "òtúùnla",
|
|
38
|
+
"past": "-{0} d",
|
|
39
|
+
"future": "+{0} d"
|
|
40
|
+
},
|
|
41
|
+
"hour": {
|
|
42
|
+
"current": "this hour",
|
|
43
|
+
"past": "-{0} h",
|
|
44
|
+
"future": "+{0} h"
|
|
45
|
+
},
|
|
46
|
+
"minute": {
|
|
47
|
+
"current": "this minute",
|
|
48
|
+
"past": "-{0} min",
|
|
49
|
+
"future": "+{0} min"
|
|
50
|
+
},
|
|
51
|
+
"second": {
|
|
52
|
+
"current": "now",
|
|
53
|
+
"past": "-{0} s",
|
|
54
|
+
"future": "+{0} s"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"short": {
|
|
58
|
+
"year": {
|
|
59
|
+
"previous": "Ɔdún tó kɔjá",
|
|
60
|
+
"current": "Ɔdún yìí",
|
|
61
|
+
"next": "Ɔdún tó ńbɔ̀",
|
|
62
|
+
"past": "-{0} y",
|
|
63
|
+
"future": "+{0} y"
|
|
64
|
+
},
|
|
65
|
+
"quarter": {
|
|
66
|
+
"previous": "last quarter",
|
|
67
|
+
"current": "this quarter",
|
|
68
|
+
"next": "next quarter",
|
|
69
|
+
"past": "-{0} Q",
|
|
70
|
+
"future": "+{0} Q"
|
|
71
|
+
},
|
|
72
|
+
"month": {
|
|
73
|
+
"previous": "óshù tó kɔjá",
|
|
74
|
+
"current": "oshù yìí",
|
|
75
|
+
"next": "óshù tó ń bɔ̀,",
|
|
76
|
+
"past": "-{0} m",
|
|
77
|
+
"future": "+{0} m"
|
|
78
|
+
},
|
|
79
|
+
"week": {
|
|
80
|
+
"previous": "ɔ̀sɛ̀ tó kɔjá",
|
|
81
|
+
"current": "ɔ̀sɛ̀ yìí",
|
|
82
|
+
"next": "ɔ́sɛ̀ tó ń bɔ̀",
|
|
83
|
+
"past": "-{0} w",
|
|
84
|
+
"future": "+{0} w"
|
|
85
|
+
},
|
|
86
|
+
"day": {
|
|
87
|
+
"previous": "Àná",
|
|
88
|
+
"previous-2": "íjɛta",
|
|
89
|
+
"current": "Òní",
|
|
90
|
+
"next": "Ɔ̀la",
|
|
91
|
+
"next-2": "òtúùnla",
|
|
92
|
+
"past": "-{0} d",
|
|
93
|
+
"future": "+{0} d"
|
|
94
|
+
},
|
|
95
|
+
"hour": {
|
|
96
|
+
"current": "this hour",
|
|
97
|
+
"past": "-{0} h",
|
|
98
|
+
"future": "+{0} h"
|
|
99
|
+
},
|
|
100
|
+
"minute": {
|
|
101
|
+
"current": "this minute",
|
|
102
|
+
"past": "-{0} min",
|
|
103
|
+
"future": "+{0} min"
|
|
104
|
+
},
|
|
105
|
+
"second": {
|
|
106
|
+
"current": "now",
|
|
107
|
+
"past": "-{0} s",
|
|
108
|
+
"future": "+{0} s"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"narrow": {
|
|
112
|
+
"year": {
|
|
113
|
+
"previous": "Ɔdún tó kɔjá",
|
|
114
|
+
"current": "Ɔdún yìí",
|
|
115
|
+
"next": "Ɔdún tó ńbɔ̀",
|
|
116
|
+
"past": "-{0} y",
|
|
117
|
+
"future": "+{0} y"
|
|
118
|
+
},
|
|
119
|
+
"quarter": {
|
|
120
|
+
"previous": "last quarter",
|
|
121
|
+
"current": "this quarter",
|
|
122
|
+
"next": "next quarter",
|
|
123
|
+
"past": "-{0} Q",
|
|
124
|
+
"future": "+{0} Q"
|
|
125
|
+
},
|
|
126
|
+
"month": {
|
|
127
|
+
"previous": "óshù tó kɔjá",
|
|
128
|
+
"current": "oshù yìí",
|
|
129
|
+
"next": "óshù tó ń bɔ̀,",
|
|
130
|
+
"past": "-{0} m",
|
|
131
|
+
"future": "+{0} m"
|
|
132
|
+
},
|
|
133
|
+
"week": {
|
|
134
|
+
"previous": "ɔ̀sɛ̀ tó kɔjá",
|
|
135
|
+
"current": "ɔ̀sɛ̀ yìí",
|
|
136
|
+
"next": "ɔ́sɛ̀ tó ń bɔ̀",
|
|
137
|
+
"past": "-{0} w",
|
|
138
|
+
"future": "+{0} w"
|
|
139
|
+
},
|
|
140
|
+
"day": {
|
|
141
|
+
"previous": "Àná",
|
|
142
|
+
"previous-2": "íjɛta",
|
|
143
|
+
"current": "Òní",
|
|
144
|
+
"next": "Ɔ̀la",
|
|
145
|
+
"next-2": "òtúùnla",
|
|
146
|
+
"past": "-{0} d",
|
|
147
|
+
"future": "+{0} d"
|
|
148
|
+
},
|
|
149
|
+
"hour": {
|
|
150
|
+
"current": "this hour",
|
|
151
|
+
"past": "-{0} h",
|
|
152
|
+
"future": "+{0} h"
|
|
153
|
+
},
|
|
154
|
+
"minute": {
|
|
155
|
+
"current": "this minute",
|
|
156
|
+
"past": "-{0} min",
|
|
157
|
+
"future": "+{0} min"
|
|
158
|
+
},
|
|
159
|
+
"second": {
|
|
160
|
+
"current": "now",
|
|
161
|
+
"past": "-{0} s",
|
|
162
|
+
"future": "+{0} s"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
package/locale/yo.json
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "yo",
|
|
3
|
+
"long": {
|
|
4
|
+
"year": {
|
|
5
|
+
"previous": "Èṣín",
|
|
6
|
+
"current": "Ọdúnǹí",
|
|
7
|
+
"next": "Àmọ́dún",
|
|
8
|
+
"past": "-{0} y",
|
|
9
|
+
"future": "+{0} y"
|
|
10
|
+
},
|
|
11
|
+
"quarter": {
|
|
12
|
+
"previous": "last quarter",
|
|
13
|
+
"current": "this quarter",
|
|
14
|
+
"next": "next quarter",
|
|
15
|
+
"past": "-{0} Q",
|
|
16
|
+
"future": "+{0} Q"
|
|
17
|
+
},
|
|
18
|
+
"month": {
|
|
19
|
+
"previous": "óṣù tó kọjá",
|
|
20
|
+
"current": "oṣù yìí",
|
|
21
|
+
"next": "óṣù tó ń bọ̀,",
|
|
22
|
+
"past": "-{0} m",
|
|
23
|
+
"future": "+{0} m"
|
|
24
|
+
},
|
|
25
|
+
"week": {
|
|
26
|
+
"previous": "ọ̀sẹ̀ tó kọjá",
|
|
27
|
+
"current": "ọ̀sẹ̀ yìí",
|
|
28
|
+
"next": "ọ́sẹ̀ tó ń bọ̀",
|
|
29
|
+
"past": "-{0} w",
|
|
30
|
+
"future": "+{0} w"
|
|
31
|
+
},
|
|
32
|
+
"day": {
|
|
33
|
+
"previous": "Àná",
|
|
34
|
+
"previous-2": "íjẹta",
|
|
35
|
+
"current": "Òní",
|
|
36
|
+
"next": "Ọ̀la",
|
|
37
|
+
"next-2": "òtúùnla",
|
|
38
|
+
"past": "-{0} d",
|
|
39
|
+
"future": "+{0} d"
|
|
40
|
+
},
|
|
41
|
+
"hour": {
|
|
42
|
+
"current": "this hour",
|
|
43
|
+
"past": "-{0} h",
|
|
44
|
+
"future": "+{0} h"
|
|
45
|
+
},
|
|
46
|
+
"minute": {
|
|
47
|
+
"current": "this minute",
|
|
48
|
+
"past": "-{0} min",
|
|
49
|
+
"future": "+{0} min"
|
|
50
|
+
},
|
|
51
|
+
"second": {
|
|
52
|
+
"current": "now",
|
|
53
|
+
"past": "-{0} s",
|
|
54
|
+
"future": "+{0} s"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"short": {
|
|
58
|
+
"year": {
|
|
59
|
+
"previous": "Ọdún tó kọjá",
|
|
60
|
+
"current": "Ọdún yìí",
|
|
61
|
+
"next": "Ọdún tó ńbọ̀",
|
|
62
|
+
"past": "-{0} y",
|
|
63
|
+
"future": "+{0} y"
|
|
64
|
+
},
|
|
65
|
+
"quarter": {
|
|
66
|
+
"previous": "last quarter",
|
|
67
|
+
"current": "this quarter",
|
|
68
|
+
"next": "next quarter",
|
|
69
|
+
"past": "-{0} Q",
|
|
70
|
+
"future": "+{0} Q"
|
|
71
|
+
},
|
|
72
|
+
"month": {
|
|
73
|
+
"previous": "óṣù tó kọjá",
|
|
74
|
+
"current": "oṣù yìí",
|
|
75
|
+
"next": "óṣù tó ń bọ̀,",
|
|
76
|
+
"past": "-{0} m",
|
|
77
|
+
"future": "+{0} m"
|
|
78
|
+
},
|
|
79
|
+
"week": {
|
|
80
|
+
"previous": "ọ̀sẹ̀ tó kọjá",
|
|
81
|
+
"current": "ọ̀sẹ̀ yìí",
|
|
82
|
+
"next": "ọ́sẹ̀ tó ń bọ̀",
|
|
83
|
+
"past": "-{0} w",
|
|
84
|
+
"future": "+{0} w"
|
|
85
|
+
},
|
|
86
|
+
"day": {
|
|
87
|
+
"previous": "Àná",
|
|
88
|
+
"previous-2": "íjẹta",
|
|
89
|
+
"current": "Òní",
|
|
90
|
+
"next": "Ọ̀la",
|
|
91
|
+
"next-2": "òtúùnla",
|
|
92
|
+
"past": "-{0} d",
|
|
93
|
+
"future": "+{0} d"
|
|
94
|
+
},
|
|
95
|
+
"hour": {
|
|
96
|
+
"current": "this hour",
|
|
97
|
+
"past": "-{0} h",
|
|
98
|
+
"future": "+{0} h"
|
|
99
|
+
},
|
|
100
|
+
"minute": {
|
|
101
|
+
"current": "this minute",
|
|
102
|
+
"past": "-{0} min",
|
|
103
|
+
"future": "+{0} min"
|
|
104
|
+
},
|
|
105
|
+
"second": {
|
|
106
|
+
"current": "now",
|
|
107
|
+
"past": "-{0} s",
|
|
108
|
+
"future": "+{0} s"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"narrow": {
|
|
112
|
+
"year": {
|
|
113
|
+
"previous": "Ọdún tó kọjá",
|
|
114
|
+
"current": "Ọdún yìí",
|
|
115
|
+
"next": "Ọdún tó ńbọ̀",
|
|
116
|
+
"past": "-{0} y",
|
|
117
|
+
"future": "+{0} y"
|
|
118
|
+
},
|
|
119
|
+
"quarter": {
|
|
120
|
+
"previous": "last quarter",
|
|
121
|
+
"current": "this quarter",
|
|
122
|
+
"next": "next quarter",
|
|
123
|
+
"past": "-{0} Q",
|
|
124
|
+
"future": "+{0} Q"
|
|
125
|
+
},
|
|
126
|
+
"month": {
|
|
127
|
+
"previous": "óṣù tó kọjá",
|
|
128
|
+
"current": "oṣù yìí",
|
|
129
|
+
"next": "óṣù tó ń bọ̀,",
|
|
130
|
+
"past": "-{0} m",
|
|
131
|
+
"future": "+{0} m"
|
|
132
|
+
},
|
|
133
|
+
"week": {
|
|
134
|
+
"previous": "ọ̀sẹ̀ tó kọjá",
|
|
135
|
+
"current": "ọ̀sẹ̀ yìí",
|
|
136
|
+
"next": "ọ́sẹ̀ tó ń bọ̀",
|
|
137
|
+
"past": "-{0} w",
|
|
138
|
+
"future": "+{0} w"
|
|
139
|
+
},
|
|
140
|
+
"day": {
|
|
141
|
+
"previous": "Àná",
|
|
142
|
+
"previous-2": "íjẹta",
|
|
143
|
+
"current": "Òní",
|
|
144
|
+
"next": "Ọ̀la",
|
|
145
|
+
"next-2": "òtúùnla",
|
|
146
|
+
"past": "-{0} d",
|
|
147
|
+
"future": "+{0} d"
|
|
148
|
+
},
|
|
149
|
+
"hour": {
|
|
150
|
+
"current": "this hour",
|
|
151
|
+
"past": "-{0} h",
|
|
152
|
+
"future": "+{0} h"
|
|
153
|
+
},
|
|
154
|
+
"minute": {
|
|
155
|
+
"current": "this minute",
|
|
156
|
+
"past": "-{0} min",
|
|
157
|
+
"future": "+{0} min"
|
|
158
|
+
},
|
|
159
|
+
"second": {
|
|
160
|
+
"current": "now",
|
|
161
|
+
"past": "-{0} s",
|
|
162
|
+
"future": "+{0} s"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
package/locale/yue/index.js
CHANGED
package/locale/yue-Hans/index.js
CHANGED
package/locale/zh/index.js
CHANGED
package/locale/zh-Hant/index.js
CHANGED
package/locale/zu/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"year": "{0}वर्ष",
|
|
3
3
|
"quarter": {
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"other": "{0}तिमाहियों"
|
|
7
|
-
},
|
|
8
|
-
"future": {
|
|
9
|
-
"one": "{0}तिमाही",
|
|
10
|
-
"other": "{0}तिमाहियों"
|
|
11
|
-
}
|
|
4
|
+
"one": "{0}तिमाही",
|
|
5
|
+
"other": "{0}तिमाहियों"
|
|
12
6
|
},
|
|
13
7
|
"month": "{0}माह",
|
|
14
8
|
"week": "{0}सप्ताह",
|
package/modules/TimeAgo.js
CHANGED
|
@@ -505,14 +505,14 @@ TimeAgo.setDefaultLocale = function (locale) {
|
|
|
505
505
|
return defaultLocale = locale;
|
|
506
506
|
};
|
|
507
507
|
/**
|
|
508
|
-
* Adds locale data for a specific locale.
|
|
508
|
+
* Adds locale data for a specific locale and marks the locale as default.
|
|
509
509
|
* @param {Object} localeData
|
|
510
510
|
*/
|
|
511
511
|
|
|
512
512
|
|
|
513
513
|
TimeAgo.addDefaultLocale = function (localeData) {
|
|
514
514
|
if (defaultLocaleHasBeenSpecified) {
|
|
515
|
-
|
|
515
|
+
return console.error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.');
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
defaultLocaleHasBeenSpecified = true;
|
package/modules/TimeAgo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../source/TimeAgo.js"],"names":["RelativeTimeFormatPolyfill","Cache","chooseLocale","getStep","getStepDenominator","getTimeToNextUpdate","addLocaleData","getLocaleData","defaultStyle","getStyleByName","getRoundFunction","UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","relativeTimeFormatCache","pluralRulesCache","input","style","options","isStyle","undefined","timestamp","getTimestamp","getLabels","flavour","labels","labelsType","now","Date","secondsPassed","future","nowLabel","getNowLabel","long","custom","date","time","elapsed","units","getTimeIntervalMeasurementUnits","round","gradation","steps","getNextStep","prevStep","step","nextStep","formattedDate","formatDateForStep","timeToNextUpdate","format","formatAs","unit","value","formatValue","Error","JSON","stringify","amount","Math","abs","granularity","valueForFormatting","sign","getFormatter","getFormattingRule","replace","formatNumber","formattingRules","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","addLocale","addLabels","name","constructor","isMockedDate","getTime","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","OBJECT_CONSTRUCTOR","isObject","variable","isStyleObject","Array","isArray"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,0BAAP,MAAuC,sBAAvC;AAEA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,OAAP,MAAoB,iBAApB;AACA,OAAOC,kBAAP,MAA+B,4BAA/B;AACA,OAAOC,mBAAP,MAAgC,6BAAhC;AAEA,SACCC,aADD,EAECC,aAFD,QAGO,mBAHP;AAKA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,cAAP,MAA2B,wBAA3B;AAEA,SAASC,gBAAT,QAAiC,SAAjC,C,CAEA;;AACA,IAAMC,KAAK,GAAG,CACb,KADa,EAEb;AACA,QAHa,EAIb,QAJa,EAKb,MALa,EAMb,KANa,EAOb,MAPa,EAQb,OARa,EASb,SATa,EAUb,MAVa,CAAd;;IAaqBC,O;;;AACpB;;;;AAIA,qBAA6C;AAAA,QAAjCC,OAAiC,uEAAvB,EAAuB;;AAAA,mFAAJ,EAAI;AAAA,QAAjBC,QAAiB,QAAjBA,QAAiB;;AAAA;;AAC5C;AACA,QAAI,OAAOD,OAAP,KAAmB,QAAvB,EAAiC;AAChCA,MAAAA,OAAO,GAAG,CAACA,OAAD,CAAV;AACA,KAJ2C,CAM5C;AACA;AACA;;;AACA,SAAKE,MAAL,GAAcb,YAAY,CACzBW,OAAO,CAACG,MAAR,CAAeJ,OAAO,CAACK,gBAAR,EAAf,CADyB,EAEzBV,aAFyB,CAA1B;;AAKA,QAAI,OAAOW,IAAP,KAAgB,WAApB,EAAiC;AAChC;AACA,UAAIA,IAAI,CAACC,YAAT,EAAuB;AACtB,aAAKC,YAAL,GAAoB,IAAIF,IAAI,CAACC,YAAT,CAAsB,KAAKJ,MAA3B,CAApB;AACA;AACD,KAnB2C,CAqB5C;AACA;AACA;AACA;;;AACA,QAAID,QAAQ,KAAK,KAAjB,E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AACX,aAAOC,QAAQ,CAACD,MAAhB;AACA,KAFD,MAEO;AACN,aAAOC,QAAQ,CAACsE,IAAhB;AACA;AACD,GAlB0D,CAmB3D;;;AACA,MAAID,UAAU,IAAIA,UAAU,CAACE,MAAzB,IAAmCF,UAAU,CAACE,MAAX,CAAkBC,OAAzD,EAAkE;AACjE,WAAOH,UAAU,CAACE,MAAX,CAAkBC,OAAzB;AACA;AACD;;AAED,IAAMC,kBAAkB,GAAG,GAAGf,WAA9B;;AACA,SAASgB,QAAT,CAAkBb,MAAlB,EAA0B;AACzB,SAAO,QAAOA,MAAP,MAAkBxE,SAAlB,IAA+BwE,MAAM,KAAK,IAA1C,IAAkDA,MAAM,CAACH,WAAP,KAAuBe,kBAAhF;AACA;;AAED,SAASrF,OAAT,CAAiBuF,QAAjB,EAA2B;AAC1B,SAAO,OAAOA,QAAP,KAAoB,QAApB,IAAgCC,aAAa,CAACD,QAAD,CAApD;AACA;;AAED,OAAO,SAASC,aAAT,CAAuBf,MAAvB,EAA+B;AACrC,SAAOa,QAAQ,CAACb,MAAD,CAAR,KACNgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAAClD,KAArB,KACA;AACAkE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACnD,SAArB,CAFA,IAGA;AACAmE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACpE,OAArB,CAJA,IAKA,OAAOoE,MAAM,CAACpE,OAAd,KAA0B,QAL1B,IAMAoF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACnE,MAArB,CANA,IAOA,OAAOmE,MAAM,CAACnE,MAAd,KAAyB,QAPzB,IAQA;AACAmF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtD,KAArB,CATA,IAUA;AACA,SAAOsD,MAAM,CAAC1D,MAAd,KAAyB,UAZnB,CAAP;AAcA","sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache'\r\nimport chooseLocale from './locale'\r\nimport getStep from './steps/getStep'\r\nimport getStepDenominator from './steps/getStepDenominator'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore'\r\n\r\nimport defaultStyle from './style/roundMinute'\r\nimport getStyleByName from './style/getStyleByName'\r\n\r\nimport { getRoundFunction } from './round'\r\n\r\n// Valid time units.\r\nconst UNITS = [\r\n\t'now',\r\n\t// The rest are the same as in `Intl.RelativeTimeFormat`.\r\n\t'second',\r\n\t'minute',\r\n\t'hour',\r\n\t'day',\r\n\t'week',\r\n\t'month',\r\n\t'quarter',\r\n\t'year'\r\n]\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\tlet now\r\n\t\t// Can pass a custom `now`, e.g. for testing purposes.\r\n\t\t//\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\t// That way is deprecated.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// The new way is passing `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = Date.now()\r\n\t\t}\r\n\r\n\t\t// how much time has passed (in seconds)\r\n\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\tconst nowLabel = getNowLabel(\r\n\t\t\tlabels,\r\n\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\tfuture\r\n\t\t)\r\n\r\n\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t//\r\n\t\t// Looks like `custom` function is deprecated and will be removed\r\n\t\t// in the next major version.\r\n\t\t//\r\n\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t// This feature is currently not used anywhere and is here\r\n\t\t// just for providing the ultimate customization point\r\n\t\t// in case anyone would ever need that. Prefer using\r\n\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t//\r\n\t\tif (style.custom) {\r\n\t\t\tconst custom = style.custom({\r\n\t\t\t\tnow,\r\n\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\ttime: timestamp,\r\n\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\tlocale: this.locale\r\n\t\t\t})\r\n\t\t\tif (custom !== undefined) {\r\n\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\treturn custom\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Get the list of available time interval units.\r\n\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t// create a new custom `style` instead.\r\n\t\t\tstyle.units,\r\n\t\t\tlabels,\r\n\t\t\tnowLabel\r\n\t\t)\r\n\r\n\t\t// // If no available time unit is suitable, just output an empty string.\r\n\t\t// if (units.length === 0) {\r\n\t\t// \tconsole.error(`None of the \"${units.join(', ')}\" time units have been found in \"${labelsType}\" labels for \"${this.locale}\" locale.`)\r\n\t\t// \treturn ''\r\n\t\t// }\r\n\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// Choose the appropriate time measurement unit\r\n\t\t// and get the corresponding rounded time amount.\r\n\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\tsecondsPassed,\r\n\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t)\r\n\r\n\t\tconst formattedDate = this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\tlabels,\r\n\t\t\tlabelsType,\r\n\t\t\tnowLabel,\r\n\t\t\tnow,\r\n\t\t\tfuture,\r\n\t\t\tround\r\n\t\t}) || ''\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\tnextStep,\r\n\t\t\t\tprevStep,\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture,\r\n\t\t\t\tround\r\n\t\t\t})\r\n\t\t\treturn [formattedDate, timeToNextUpdate]\r\n\t\t}\r\n\r\n\t\treturn formattedDate\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, value) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(value, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => defaultLocale = locale\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\tthrow new Error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.')\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n\tTimeAgo.addLocale(localeData)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nconst OBJECT_CONSTRUCTOR = {}.constructor\r\nfunction isObject(object) {\r\n\treturn typeof object !== undefined && object !== null && object.constructor === OBJECT_CONSTRUCTOR\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\nexport function isStyleObject(object) {\r\n\treturn isObject(object) && (\r\n\t\tArray.isArray(object.steps) ||\r\n\t\t// `gradation` property is deprecated: it has been renamed to `steps`.\r\n\t\tArray.isArray(object.gradation) ||\r\n\t\t// `flavour` property is deprecated: it has been renamed to `labels`.\r\n\t\tArray.isArray(object.flavour) ||\r\n\t\ttypeof object.flavour === 'string' ||\r\n\t\tArray.isArray(object.labels) ||\r\n\t\ttypeof object.labels === 'string' ||\r\n\t\t// `units` property is deprecated.\r\n\t\tArray.isArray(object.units) ||\r\n\t\t// `custom` property is deprecated.\r\n\t\ttypeof object.custom === 'function'\r\n\t)\r\n}"],"file":"TimeAgo.js"}
|
|
1
|
+
{"version":3,"sources":["../source/TimeAgo.js"],"names":["RelativeTimeFormatPolyfill","Cache","chooseLocale","getStep","getStepDenominator","getTimeToNextUpdate","addLocaleData","getLocaleData","defaultStyle","getStyleByName","getRoundFunction","UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","relativeTimeFormatCache","pluralRulesCache","input","style","options","isStyle","undefined","timestamp","getTimestamp","getLabels","flavour","labels","labelsType","now","Date","secondsPassed","future","nowLabel","getNowLabel","long","custom","date","time","elapsed","units","getTimeIntervalMeasurementUnits","round","gradation","steps","getNextStep","prevStep","step","nextStep","formattedDate","formatDateForStep","timeToNextUpdate","format","formatAs","unit","value","formatValue","Error","JSON","stringify","amount","Math","abs","granularity","valueForFormatting","sign","getFormatter","getFormattingRule","replace","formatNumber","formattingRules","pastOrFuture","quantifierRules","quantifier","getPluralRules","select","other","number","String","get","put","map","localeData","_labelsType","defaultLocale","setDefaultLocale","addDefaultLocale","defaultLocaleHasBeenSpecified","console","error","addLocale","addLabels","name","constructor","isMockedDate","getTime","object","allowedUnits","Object","keys","push","filter","indexOf","nowLabels","longLabels","past","second","current","OBJECT_CONSTRUCTOR","isObject","variable","isStyleObject","Array","isArray"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,0BAAP,MAAuC,sBAAvC;AAEA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,OAAP,MAAoB,iBAApB;AACA,OAAOC,kBAAP,MAA+B,4BAA/B;AACA,OAAOC,mBAAP,MAAgC,6BAAhC;AAEA,SACCC,aADD,EAECC,aAFD,QAGO,mBAHP;AAKA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,cAAP,MAA2B,wBAA3B;AAEA,SAASC,gBAAT,QAAiC,SAAjC,C,CAEA;;AACA,IAAMC,KAAK,GAAG,CACb,KADa,EAEb;AACA,QAHa,EAIb,QAJa,EAKb,MALa,EAMb,KANa,EAOb,MAPa,EAQb,OARa,EASb,SATa,EAUb,MAVa,CAAd;;IAaqBC,O;;;AACpB;;;;AAIA,qBAA6C;AAAA,QAAjCC,OAAiC,uEAAvB,EAAuB;;AAAA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NgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACpD,KAArB,KACA;AACAoE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrD,SAArB,CAFA,IAGA;AACAqE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtE,OAArB,CAJA,IAKA,OAAOsE,MAAM,CAACtE,OAAd,KAA0B,QAL1B,IAMAsF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrE,MAArB,CANA,IAOA,OAAOqE,MAAM,CAACrE,MAAd,KAAyB,QAPzB,IAQA;AACAqF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACxD,KAArB,CATA,IAUA;AACA,SAAOwD,MAAM,CAAC5D,MAAd,KAAyB,UAZnB,CAAP;AAcA","sourcesContent":["import RelativeTimeFormatPolyfill from 'relative-time-format'\r\n\r\nimport Cache from './cache'\r\nimport chooseLocale from './locale'\r\nimport getStep from './steps/getStep'\r\nimport getStepDenominator from './steps/getStepDenominator'\r\nimport getTimeToNextUpdate from './steps/getTimeToNextUpdate'\r\n\r\nimport {\r\n\taddLocaleData,\r\n\tgetLocaleData\r\n} from './LocaleDataStore'\r\n\r\nimport defaultStyle from './style/roundMinute'\r\nimport getStyleByName from './style/getStyleByName'\r\n\r\nimport { getRoundFunction } from './round'\r\n\r\n// Valid time units.\r\nconst UNITS = [\r\n\t'now',\r\n\t// The rest are the same as in `Intl.RelativeTimeFormat`.\r\n\t'second',\r\n\t'minute',\r\n\t'hour',\r\n\t'day',\r\n\t'week',\r\n\t'month',\r\n\t'quarter',\r\n\t'year'\r\n]\r\n\r\nexport default class TimeAgo {\r\n\t/**\r\n\t * @param {(string|string[])} locales=[] - Preferred locales (or locale).\r\n\t * @param {boolean} [polyfill] — Pass `false` to use native `Intl.RelativeTimeFormat` and `Intl.PluralRules` instead of the polyfills.\r\n\t */\r\n\tconstructor(locales = [], { polyfill } = {}) {\r\n\t\t// Convert `locales` to an array.\r\n\t\tif (typeof locales === 'string') {\r\n\t\t\tlocales = [locales]\r\n\t\t}\r\n\r\n\t\t// Choose the most appropriate locale\r\n\t\t// from the list of `locales` added by the user.\r\n\t\t// For example, new TimeAgo(\"en-US\") -> \"en\".\r\n\t\tthis.locale = chooseLocale(\r\n\t\t\tlocales.concat(TimeAgo.getDefaultLocale()),\r\n\t\t\tgetLocaleData\r\n\t\t)\r\n\r\n\t\tif (typeof Intl !== 'undefined') {\r\n\t\t\t// Use `Intl.NumberFormat` for formatting numbers (when available).\r\n\t\t\tif (Intl.NumberFormat) {\r\n\t\t\t\tthis.numberFormat = new Intl.NumberFormat(this.locale)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Some people have requested the ability to use native\r\n\t\t// `Intl.RelativeTimeFormat` and `Intl.PluralRules`\r\n\t\t// instead of the polyfills.\r\n\t\t// https://github.com/catamphetamine/javascript-time-ago/issues/21\r\n\t\tif (polyfill === false) {\r\n\t\t\tthis.IntlRelativeTimeFormat = Intl.RelativeTimeFormat\r\n\t\t\tthis.IntlPluralRules = Intl.PluralRules\r\n\t\t} else {\r\n\t\t\tthis.IntlRelativeTimeFormat = RelativeTimeFormatPolyfill\r\n\t\t\tthis.IntlPluralRules = RelativeTimeFormatPolyfill.PluralRules\r\n\t\t}\r\n\r\n\t\t// Cache `Intl.RelativeTimeFormat` instance.\r\n\t\tthis.relativeTimeFormatCache = new Cache()\r\n\r\n\t\t// Cache `Intl.PluralRules` instance.\r\n\t\tthis.pluralRulesCache = new Cache()\r\n\t}\r\n\r\n\t/**\r\n\t * Formats relative date/time.\r\n\t *\r\n\t * @param {number} [options.now] - Sets the current date timestamp.\r\n\t *\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`:\r\n\t * as \"future\" (`true`) or \"past\" (`false`).\r\n\t * Is `false` by default, but should have been `true` actually,\r\n\t * in order to correspond to `Intl.RelativeTimeFormat`\r\n\t * that uses `future` formatting for `0` unless `-0` is passed.\r\n\t *\r\n\t * @param {string} [options.round] — Rounding method. Overrides the style's one.\r\n\t *\r\n\t * @param {boolean} [options.getTimeToNextUpdate] — Pass `true` to return `[formattedDate, timeToNextUpdate]` instead of just `formattedDate`.\r\n\t *\r\n\t * @return {string} The formatted relative date/time. If no eligible `step` is found, then an empty string is returned.\r\n\t */\r\n\tformat(input, style, options) {\r\n\t\tif (!options) {\r\n\t\t\tif (style && !isStyle(style)) {\r\n\t\t\t\toptions = style\r\n\t\t\t\tstyle = undefined\r\n\t\t\t} else {\r\n\t\t\t\toptions = {}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (!style) {\r\n\t\t\tstyle = defaultStyle\r\n\t\t}\r\n\r\n\t\tif (typeof style === 'string') {\r\n\t\t\tstyle = getStyleByName(style)\r\n\t\t}\r\n\r\n\t\tconst timestamp = getTimestamp(input)\r\n\r\n\t\t// Get locale messages for this type of labels.\r\n\t\t// \"flavour\" is a legacy name for \"labels\".\r\n\t\tconst { labels, labelsType } = this.getLabels(style.flavour || style.labels)\r\n\r\n\t\tlet now\r\n\t\t// Can pass a custom `now`, e.g. for testing purposes.\r\n\t\t//\r\n\t\t// Legacy way was passing `now` in `style`.\r\n\t\t// That way is deprecated.\r\n\t\tif (style.now !== undefined) {\r\n\t\t\tnow = style.now\r\n\t\t}\r\n\t\t// The new way is passing `now` option to `.format()`.\r\n\t\tif (now === undefined && options.now !== undefined) {\r\n\t\t\tnow = options.now\r\n\t\t}\r\n\t\tif (now === undefined) {\r\n\t\t\tnow = Date.now()\r\n\t\t}\r\n\r\n\t\t// how much time has passed (in seconds)\r\n\t\tconst secondsPassed = (now - timestamp) / 1000 // in seconds\r\n\r\n\t\tconst future = options.future || secondsPassed < 0\r\n\r\n\t\tconst nowLabel = getNowLabel(\r\n\t\t\tlabels,\r\n\t\t\tgetLocaleData(this.locale).now,\r\n\t\t\tgetLocaleData(this.locale).long,\r\n\t\t\tfuture\r\n\t\t)\r\n\r\n\t\t// `custom` – A function of `{ elapsed, time, date, now, locale }`.\r\n\t\t//\r\n\t\t// Looks like `custom` function is deprecated and will be removed\r\n\t\t// in the next major version.\r\n\t\t//\r\n\t\t// If this function returns a value, then the `.format()` call will return that value.\r\n\t\t// Otherwise the relative date/time is formatted as usual.\r\n\t\t// This feature is currently not used anywhere and is here\r\n\t\t// just for providing the ultimate customization point\r\n\t\t// in case anyone would ever need that. Prefer using\r\n\t\t// `steps[step].format(value, locale)` instead.\r\n\t\t//\r\n\t\tif (style.custom) {\r\n\t\t\tconst custom = style.custom({\r\n\t\t\t\tnow,\r\n\t\t\t\tdate: new Date(timestamp),\r\n\t\t\t\ttime: timestamp,\r\n\t\t\t\telapsed: secondsPassed,\r\n\t\t\t\tlocale: this.locale\r\n\t\t\t})\r\n\t\t\tif (custom !== undefined) {\r\n\t\t\t\t// Won't return `timeToNextUpdate` here\r\n\t\t\t\t// because `custom()` seems deprecated.\r\n\t\t\t\treturn custom\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Get the list of available time interval units.\r\n\t\tconst units = getTimeIntervalMeasurementUnits(\r\n\t\t\t// Controlling `style.steps` through `style.units` seems to be deprecated:\r\n\t\t\t// create a new custom `style` instead.\r\n\t\t\tstyle.units,\r\n\t\t\tlabels,\r\n\t\t\tnowLabel\r\n\t\t)\r\n\r\n\t\t// // If no available time unit is suitable, just output an empty string.\r\n\t\t// if (units.length === 0) {\r\n\t\t// \tconsole.error(`None of the \"${units.join(', ')}\" time units have been found in \"${labelsType}\" labels for \"${this.locale}\" locale.`)\r\n\t\t// \treturn ''\r\n\t\t// }\r\n\r\n\t\tconst round = options.round || style.round\r\n\r\n\t\t// Choose the appropriate time measurement unit\r\n\t\t// and get the corresponding rounded time amount.\r\n\t\tconst [prevStep, step, nextStep] = getStep(\r\n\t\t\t// \"gradation\" is a legacy name for \"steps\".\r\n\t\t\t// For historical reasons, \"approximate\" steps are used by default.\r\n\t\t\t// In the next major version, there'll be no default for `steps`.\r\n\t\t\tstyle.gradation || style.steps || defaultStyle.steps,\r\n\t\t\tsecondsPassed,\r\n\t\t\t{ now, units, round, future, getNextStep: true }\r\n\t\t)\r\n\r\n\t\tconst formattedDate = this.formatDateForStep(timestamp, step, secondsPassed, {\r\n\t\t\tlabels,\r\n\t\t\tlabelsType,\r\n\t\t\tnowLabel,\r\n\t\t\tnow,\r\n\t\t\tfuture,\r\n\t\t\tround\r\n\t\t}) || ''\r\n\r\n\t\tif (options.getTimeToNextUpdate) {\r\n\t\t\tconst timeToNextUpdate = getTimeToNextUpdate(timestamp, step, {\r\n\t\t\t\tnextStep,\r\n\t\t\t\tprevStep,\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture,\r\n\t\t\t\tround\r\n\t\t\t})\r\n\t\t\treturn [formattedDate, timeToNextUpdate]\r\n\t\t}\r\n\r\n\t\treturn formattedDate\r\n\t}\r\n\r\n\tformatDateForStep(timestamp, step, secondsPassed, {\r\n\t\tlabels,\r\n\t\tlabelsType,\r\n\t\tnowLabel,\r\n\t\tnow,\r\n\t\tfuture,\r\n\t\tround\r\n\t}) {\r\n\t\t// If no step matches, then output an empty string.\r\n\t\tif (!step) {\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tif (step.format) {\r\n\t\t\treturn step.format(timestamp, this.locale, {\r\n\t\t\t\tformatAs: (unit, value) => {\r\n\t\t\t\t\t// Mimicks `Intl.RelativeTimeFormat.format()`.\r\n\t\t\t\t\treturn this.formatValue(value, unit, {\r\n\t\t\t\t\t\tlabels,\r\n\t\t\t\t\t\tfuture\r\n\t\t\t\t\t})\r\n\t\t\t\t},\r\n\t\t\t\tnow,\r\n\t\t\t\tfuture\r\n\t\t\t})\r\n\t\t}\r\n\r\n\t\t// \"unit\" is now called \"formatAs\".\r\n\t\tconst unit = step.unit || step.formatAs\r\n\r\n\t\tif (!unit) {\r\n\t\t\tthrow new Error(`[javascript-time-ago] Each step must define either \\`formatAs\\` or \\`format()\\`. Step: ${JSON.stringify(step)}`)\r\n\t\t}\r\n\r\n\t\t// `Intl.RelativeTimeFormat` doesn't operate in \"now\" units.\r\n\t\t// Therefore, threat \"now\" as a special case.\r\n\t\tif (unit === 'now') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\r\n\t\t// Amount in units.\r\n\t\tlet amount = Math.abs(secondsPassed) / getStepDenominator(step)\r\n\r\n\t\t// Apply granularity to the time amount\r\n\t\t// (and fallback to the previous step\r\n\t\t// if the first level of granularity\r\n\t\t// isn't met by this amount)\r\n\t\t//\r\n\t\t// `granularity` — (advanced) Time interval value \"granularity\".\r\n\t\t// For example, it could be set to `5` for minutes to allow only 5-minute increments\r\n\t\t// when formatting time intervals: `0 minutes`, `5 minutes`, `10 minutes`, etc.\r\n\t\t// Perhaps this feature will be removed because there seem to be no use cases\r\n\t\t// of it in the real world.\r\n\t\t//\r\n\t\tif (step.granularity) {\r\n\t\t\t// Recalculate the amount of seconds passed based on granularity\r\n\t\t\tamount = getRoundFunction(round)(amount / step.granularity) * step.granularity\r\n\t\t}\r\n\r\n\t\tlet valueForFormatting = -1 * Math.sign(secondsPassed) * getRoundFunction(round)(amount)\r\n\r\n\t\t// By default, this library formats a `0` in \"past\" mode,\r\n\t\t// unless `future: true` option is passed.\r\n\t\t// This is different to `relative-time-format`'s behavior\r\n\t\t// which formats a `0` in \"future\" mode by default, unless it's a `-0`.\r\n\t\t// So, convert `0` to `-0` if `future: true` option wasn't passed.\r\n\t\t// `=== 0` matches both `0` and `-0`.\r\n\t\tif (valueForFormatting === 0) {\r\n\t\t\tif (future) {\r\n\t\t\t\tvalueForFormatting = 0\r\n\t\t\t} else {\r\n\t\t\t\tvalueForFormatting = -0\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tswitch (labelsType) {\r\n\t\t\tcase 'long':\r\n\t\t\tcase 'short':\r\n\t\t\tcase 'narrow':\r\n\t\t\t\t// Format the amount using `Intl.RelativeTimeFormat`.\r\n\t\t\t\treturn this.getFormatter(labelsType).format(valueForFormatting, unit)\r\n\t\t\tdefault:\r\n\t\t\t\t// Format the amount.\r\n\t\t\t\t// (mimicks `Intl.RelativeTimeFormat` behavior for other time label styles)\r\n\t\t\t\treturn this.formatValue(valueForFormatting, unit, {\r\n\t\t\t\t\tlabels,\r\n\t\t\t\t\tfuture\r\n\t\t\t\t})\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Mimicks what `Intl.RelativeTimeFormat` does for additional locale styles.\r\n\t * @param {number} value\r\n\t * @param {string} unit\r\n\t * @param {object} options.labels — Relative time labels.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default, but should have been `true` actually.\r\n\t * @return {string}\r\n\t */\r\n\tformatValue(value, unit, { labels, future }) {\r\n\t\treturn this.getFormattingRule(labels, unit, value, { future })\r\n\t\t\t.replace('{0}', this.formatNumber(Math.abs(value)))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns formatting rule for `value` in `units` (either in past or in future).\r\n\t * @param {object} formattingRules — Relative time labels for different units.\r\n\t * @param {string} unit - Time interval measurement unit.\r\n\t * @param {number} value - Time interval value.\r\n\t * @param {boolean} [options.future] — Tells how to format value `0`: as \"future\" (`true`) or \"past\" (`false`). Is `false` by default.\r\n\t * @return {string}\r\n\t * @example\r\n\t * // Returns \"{0} days ago\"\r\n\t * getFormattingRule(en.long, \"day\", -2, 'en')\r\n\t */\r\n\tgetFormattingRule(formattingRules, unit, value, { future }) {\r\n\t\t// Passing the language is required in order to\r\n\t\t// be able to correctly classify the `value` as a number.\r\n\t\tconst locale = this.locale\r\n\t\tformattingRules = formattingRules[unit]\r\n\t\t// Check for a special \"compacted\" rules case:\r\n\t\t// if formatting rules are the same for \"past\" and \"future\",\r\n\t\t// and also for all possible `value`s, then those rules are\r\n\t\t// stored as a single string.\r\n\t\tif (typeof formattingRules === 'string') {\r\n\t\t\treturn formattingRules\r\n\t\t}\r\n\t\t// Choose either \"past\" or \"future\" based on time `value` sign.\r\n\t\t// If \"past\" is same as \"future\" then they're stored as \"other\".\r\n\t\t// If there's only \"other\" then it's being collapsed.\r\n\t\tconst pastOrFuture = value === 0 ? (future ? 'future' : 'past') : (value < 0 ? 'past' : 'future')\r\n\t\tconst quantifierRules = formattingRules[pastOrFuture] || formattingRules\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof quantifierRules === 'string') {\r\n\t\t\treturn quantifierRules\r\n\t\t}\r\n\t\t// Quantify `value`.\r\n\t\tconst quantifier = this.getPluralRules().select(Math.abs(value))\r\n\t\t// \"other\" rule is supposed to always be present.\r\n\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\r\n\t\treturn quantifierRules[quantifier] || quantifierRules.other\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a number into a string.\r\n\t * Uses `Intl.NumberFormat` when available.\r\n\t * @param {number} number\r\n\t * @return {string}\r\n\t */\r\n\tformatNumber(number) {\r\n\t\treturn this.numberFormat ? this.numberFormat.format(number) : String(number)\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.RelativeTimeFormat` for a given `labelsType`.\r\n\t * @param {string} labelsType\r\n\t * @return {object} `Intl.RelativeTimeFormat` instance\r\n\t */\r\n\tgetFormatter(labelsType) {\r\n\t\t// `Intl.RelativeTimeFormat` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.relativeTimeFormatCache.get(this.locale, labelsType) ||\r\n\t\t\tthis.relativeTimeFormatCache.put(this.locale, labelsType, new this.IntlRelativeTimeFormat(this.locale, { style: labelsType }))\r\n\t}\r\n\r\n\t/**\r\n\t * Returns an `Intl.PluralRules` instance.\r\n\t * @return {object} `Intl.PluralRules` instance\r\n\t */\r\n\tgetPluralRules() {\r\n\t\t// `Intl.PluralRules` instance creation is (hypothetically) assumed\r\n\t\t// a lengthy operation so the instances are cached and reused.\r\n\t\treturn this.pluralRulesCache.get(this.locale) ||\r\n\t\t\tthis.pluralRulesCache.put(this.locale, new this.IntlPluralRules(this.locale))\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Gets localized labels for this type of labels.\r\n\t *\r\n\t * @param {(string|string[])} labelsType - Relative date/time labels type.\r\n\t * If it's an array then all label types are tried\r\n\t * until a suitable one is found.\r\n\t *\r\n\t * @returns {Object} Returns an object of shape { labelsType, labels }\r\n\t */\r\n\tgetLabels(labelsType = []) {\r\n\t\t// Convert `labels` to an array.\r\n\t\tif (typeof labelsType === 'string') {\r\n\t\t\tlabelsType = [labelsType]\r\n\t\t}\r\n\r\n\t\t// Supports legacy \"tiny\" and \"mini-time\" label styles.\r\n\t\tlabelsType = labelsType.map((labelsType) => {\r\n\t\t\tswitch (labelsType) {\r\n\t\t\t\tcase 'tiny':\r\n\t\t\t\tcase 'mini-time':\r\n\t\t\t\t\treturn 'mini'\r\n\t\t\t\tdefault:\r\n\t\t\t\t\treturn labelsType\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// \"long\" labels type is the default one.\r\n\t\t// (it's always present for all languages)\r\n\t\tlabelsType = labelsType.concat('long')\r\n\r\n\t\t// Find a suitable labels type.\r\n\t\tconst localeData = getLocaleData(this.locale)\r\n\t\tfor (const _labelsType of labelsType) {\r\n\t\t\tif (localeData[_labelsType]) {\r\n\t\t\t\treturn {\r\n\t\t\t\t\tlabelsType: _labelsType,\r\n\t\t\t\t\tlabels: localeData[_labelsType]\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Default locale global variable.\r\n */\r\nlet defaultLocale = 'en'\r\n\r\n/**\r\n * Gets default locale.\r\n * @return {string} locale\r\n */\r\nTimeAgo.getDefaultLocale = () => defaultLocale\r\n\r\n/**\r\n * Sets default locale.\r\n * @param {string} locale\r\n */\r\nTimeAgo.setDefaultLocale = (locale) => defaultLocale = locale\r\n\r\n/**\r\n * Adds locale data for a specific locale and marks the locale as default.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addDefaultLocale = function(localeData) {\r\n\tif (defaultLocaleHasBeenSpecified) {\r\n\t\treturn console.error('[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.')\r\n\t}\r\n\tdefaultLocaleHasBeenSpecified = true\r\n\tTimeAgo.setDefaultLocale(localeData.locale)\r\n\tTimeAgo.addLocale(localeData)\r\n}\r\n\r\nlet defaultLocaleHasBeenSpecified\r\n\r\n/**\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n */\r\nTimeAgo.addLocale = function(localeData) {\r\n\taddLocaleData(localeData)\r\n\tRelativeTimeFormatPolyfill.addLocale(localeData)\r\n}\r\n\r\n/**\r\n * (legacy alias)\r\n * Adds locale data for a specific locale.\r\n * @param {Object} localeData\r\n * @deprecated\r\n */\r\nTimeAgo.locale = TimeAgo.addLocale\r\n\r\n/**\r\n * Adds custom labels to locale data.\r\n * @param {string} locale\r\n * @param {string} name\r\n * @param {object} labels\r\n */\r\nTimeAgo.addLabels = (locale, name, labels) => {\r\n\tlet localeData = getLocaleData(locale)\r\n\tif (!localeData) {\r\n\t\taddLocaleData({\r\n\t\t\tlocale\r\n\t\t})\r\n\t\tlocaleData = getLocaleData(locale)\r\n\t\t// throw new Error(`[javascript-time-ago] No data for locale \"${locale}\"`)\r\n\t}\r\n\tlocaleData[name] = labels\r\n}\r\n\r\n// Normalizes `.format()` `time` argument.\r\nfunction getTimestamp(input) {\r\n\tif (input.constructor === Date || isMockedDate(input)) {\r\n\t\treturn input.getTime()\r\n\t}\r\n\r\n\tif (typeof input === 'number') {\r\n\t\treturn input\r\n\t}\r\n\r\n\t// For some weird reason istanbul doesn't see this `throw` covered.\r\n\t/* istanbul ignore next */\r\n\tthrow new Error(`Unsupported relative time formatter input: ${typeof input}, ${input}`)\r\n}\r\n\r\n// During testing via some testing libraries `Date`s aren't actually `Date`s.\r\n// https://github.com/catamphetamine/javascript-time-ago/issues/22\r\nfunction isMockedDate(object) {\r\n\treturn typeof object === 'object' && typeof object.getTime === 'function'\r\n}\r\n\r\n// Get available time interval measurement units.\r\nfunction getTimeIntervalMeasurementUnits(allowedUnits, labels, nowLabel) {\r\n\t// Get all time interval measurement units that're available\r\n\t// in locale data for a given time labels style.\r\n\tlet units = Object.keys(labels)\r\n\r\n\t// `now` unit is handled separately and is shipped in its own `now.json` file.\r\n\t// `now.json` isn't present for all locales, so it could be substituted with\r\n\t// \".second.current\".\r\n\t// Add `now` unit if it's available in locale data.\r\n\tif (nowLabel) {\r\n\t\tunits.push('now')\r\n\t}\r\n\r\n\t// If only a specific set of available time measurement units can be used\r\n\t// then only those units are allowed (if they're present in locale data).\r\n\tif (allowedUnits) {\r\n\t\tunits = allowedUnits.filter(unit => unit === 'now' || units.indexOf(unit) >= 0)\r\n\t}\r\n\r\n\treturn units\r\n}\r\n\r\nfunction getNowLabel(labels, nowLabels, longLabels, future) {\r\n\tconst nowLabel = labels.now || (nowLabels && nowLabels.now)\r\n\t// Specific \"now\" message form extended locale data (if present).\r\n\tif (nowLabel) {\r\n\t\t// Bundle size optimization technique.\r\n\t\tif (typeof nowLabel === 'string') {\r\n\t\t\treturn nowLabel\r\n\t\t}\r\n\t\t// Not handling `value === 0` as `localeData.now.current` here\r\n\t\t// because it wouldn't make sense: \"now\" is a moment,\r\n\t\t// so one can't possibly differentiate between a\r\n\t\t// \"previous\" moment, a \"current\" moment and a \"next moment\".\r\n\t\t// It can only be differentiated between \"past\" and \"future\".\r\n\t\tif (future) {\r\n\t\t\treturn nowLabel.future\r\n\t\t} else {\r\n\t\t\treturn nowLabel.past\r\n\t\t}\r\n\t}\r\n\t// Use \".second.current\" as \"now\" message.\r\n\tif (longLabels && longLabels.second && longLabels.second.current) {\r\n\t\treturn longLabels.second.current\r\n\t}\r\n}\r\n\r\nconst OBJECT_CONSTRUCTOR = {}.constructor\r\nfunction isObject(object) {\r\n\treturn typeof object !== undefined && object !== null && object.constructor === OBJECT_CONSTRUCTOR\r\n}\r\n\r\nfunction isStyle(variable) {\r\n\treturn typeof variable === 'string' || isStyleObject(variable)\r\n}\r\n\r\nexport function isStyleObject(object) {\r\n\treturn isObject(object) && (\r\n\t\tArray.isArray(object.steps) ||\r\n\t\t// `gradation` property is deprecated: it has been renamed to `steps`.\r\n\t\tArray.isArray(object.gradation) ||\r\n\t\t// `flavour` property is deprecated: it has been renamed to `labels`.\r\n\t\tArray.isArray(object.flavour) ||\r\n\t\ttypeof object.flavour === 'string' ||\r\n\t\tArray.isArray(object.labels) ||\r\n\t\ttypeof object.labels === 'string' ||\r\n\t\t// `units` property is deprecated.\r\n\t\tArray.isArray(object.units) ||\r\n\t\t// `custom` property is deprecated.\r\n\t\ttypeof object.custom === 'function'\r\n\t)\r\n}"],"file":"TimeAgo.js"}
|
package/modules/TimeAgo.test.js
CHANGED
|
@@ -622,12 +622,12 @@ describe("javascript-time-ago", function () {
|
|
|
622
622
|
TimeAgo.addDefaultLocale({
|
|
623
623
|
locale: 'el'
|
|
624
624
|
});
|
|
625
|
-
TimeAgo.getDefaultLocale().should.equal('el');
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
625
|
+
TimeAgo.getDefaultLocale().should.equal('el'); // expect(() => {
|
|
626
|
+
|
|
627
|
+
TimeAgo.addDefaultLocale({
|
|
628
|
+
locale: 'el'
|
|
629
|
+
}); // }).to.throw('`TimeAgo.addDefaultLocale()` can only be called once')
|
|
630
|
+
|
|
631
631
|
TimeAgo.setDefaultLocale('en');
|
|
632
632
|
});
|
|
633
633
|
it('should support "floor" rounding', function () {
|