javascript-time-ago 2.3.8 → 2.3.12
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 +1 -1
- package/commonjs/TimeAgo.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/ckb/long-time.json +9 -0
- package/locale-more-styles/ckb/mini.json +9 -0
- package/locale-more-styles/ckb/now.json +7 -0
- package/locale-more-styles/ckb/short-time.json +12 -0
- package/locale-more-styles/hi/mini.json +2 -8
- package/locale-more-styles/ru/mini.json +2 -8
- package/modules/TimeAgo.js +1 -1
- package/modules/TimeAgo.js.map +1 -1
- package/package.json +7 -7
- package/index.d.ts.test +0 -47
package/commonjs/TimeAgo.js
CHANGED
|
@@ -525,7 +525,7 @@ TimeAgo.setDefaultLocale = function (locale) {
|
|
|
525
525
|
return defaultLocale = locale;
|
|
526
526
|
};
|
|
527
527
|
/**
|
|
528
|
-
* Adds locale data for a specific locale.
|
|
528
|
+
* Adds locale data for a specific locale and marks the locale as default.
|
|
529
529
|
* @param {Object} localeData
|
|
530
530
|
*/
|
|
531
531
|
|
package/commonjs/TimeAgo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../source/TimeAgo.js"],"names":["UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","input","style","options","isStyle","undefined","defaultStyle","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","getTimeToNextUpdate","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;;AAEA;;AACA;;AACA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AACA;;AAEM,SAASC,aAAT,CAAuBf,MAAvB,EAA+B;AACrC,SAAOa,QAAQ,CAACb,MAAD,CAAR,KACNgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrD,KAArB,KACA;AACAqE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtD,SAArB,CAFA,IAGA;AACAsE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACvE,OAArB,CAJA,IAKA,OAAOuE,MAAM,CAACvE,OAAd,KAA0B,QAL1B,IAMAuF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtE,MAArB,CANA,IAOA,OAAOsE,MAAM,CAACtE,MAAd,KAAyB,QAPzB,IAQA;AACAsF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACzD,KAArB,CATA,IAUA;AACA,SAAOyD,MAAM,CAAC7D,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\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"}
|
|
1
|
+
{"version":3,"sources":["../source/TimeAgo.js"],"names":["UNITS","TimeAgo","locales","polyfill","locale","concat","getDefaultLocale","getLocaleData","Intl","NumberFormat","numberFormat","IntlRelativeTimeFormat","RelativeTimeFormat","IntlPluralRules","PluralRules","RelativeTimeFormatPolyfill","relativeTimeFormatCache","Cache","pluralRulesCache","input","style","options","isStyle","undefined","defaultStyle","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","getTimeToNextUpdate","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"],"mapp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ApB,IAAgCC,aAAa,CAACD,QAAD,CAApD;AACA;;AAEM,SAASC,aAAT,CAAuBf,MAAvB,EAA+B;AACrC,SAAOa,QAAQ,CAACb,MAAD,CAAR,KACNgB,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACrD,KAArB,KACA;AACAqE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtD,SAArB,CAFA,IAGA;AACAsE,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACvE,OAArB,CAJA,IAKA,OAAOuE,MAAM,CAACvE,OAAd,KAA0B,QAL1B,IAMAuF,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACtE,MAArB,CANA,IAOA,OAAOsE,MAAM,CAACtE,MAAd,KAAyB,QAPzB,IAQA;AACAsF,EAAAA,KAAK,CAACC,OAAN,CAAcjB,MAAM,CAACzD,KAArB,CATA,IAUA;AACA,SAAOyD,MAAM,CAAC7D,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/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type DateInput = Date | number;
|
|
2
|
+
|
|
3
|
+
export type Locale = string;
|
|
4
|
+
|
|
5
|
+
export type LabelStyleName = 'long' | 'short' | 'narrow' | 'mini' | 'now';
|
|
6
|
+
|
|
7
|
+
export type Rounding = 'round' | 'floor';
|
|
8
|
+
|
|
9
|
+
// https://github.com/eemeli/make-plural/blob/master/packages/compiler/src/compile-range.js#L1
|
|
10
|
+
export type Count = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
11
|
+
|
|
12
|
+
export type CommonUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
13
|
+
export type Unit = CommonUnit | 'quarter' | 'now';
|
|
14
|
+
|
|
15
|
+
export type CountLabels = {
|
|
16
|
+
[count in Count]?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface PastAndFutureLabels {
|
|
20
|
+
past: string | CountLabels;
|
|
21
|
+
future: string | CountLabels;
|
|
22
|
+
previous?: string;
|
|
23
|
+
current?: string;
|
|
24
|
+
next?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PastAndFutureNowLabels {
|
|
28
|
+
past: string;
|
|
29
|
+
future: string;
|
|
30
|
+
current: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type UnitLabels = string | CountLabels | PastAndFutureLabels
|
|
34
|
+
|
|
35
|
+
export type Labels = {
|
|
36
|
+
year: UnitLabels;
|
|
37
|
+
quarter?: UnitLabels;
|
|
38
|
+
month: UnitLabels;
|
|
39
|
+
week: UnitLabels;
|
|
40
|
+
day: UnitLabels;
|
|
41
|
+
hour: UnitLabels;
|
|
42
|
+
minute: UnitLabels;
|
|
43
|
+
second: UnitLabels;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type UnitLabelsMini = string | CountLabels;
|
|
47
|
+
|
|
48
|
+
export type MiniLabels = {
|
|
49
|
+
year: UnitLabelsMini;
|
|
50
|
+
quarter?: UnitLabelsMini;
|
|
51
|
+
month: UnitLabelsMini;
|
|
52
|
+
week: UnitLabelsMini;
|
|
53
|
+
day: UnitLabelsMini;
|
|
54
|
+
hour: UnitLabelsMini;
|
|
55
|
+
minute: UnitLabelsMini;
|
|
56
|
+
second: UnitLabelsMini;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type NowLabels = {
|
|
60
|
+
now: string | PastAndFutureNowLabels;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type LocaleData = {
|
|
64
|
+
locale: Locale;
|
|
65
|
+
short: Labels;
|
|
66
|
+
narrow: Labels;
|
|
67
|
+
long: Labels;
|
|
68
|
+
mini?: MiniLabels;
|
|
69
|
+
now?: NowLabels;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type FormatStyleName =
|
|
73
|
+
'round' |
|
|
74
|
+
'round-minute' |
|
|
75
|
+
'mini' |
|
|
76
|
+
'mini-now' |
|
|
77
|
+
'mini-minute' |
|
|
78
|
+
'mini-minute-now' |
|
|
79
|
+
'twitter' |
|
|
80
|
+
'twitter-now' |
|
|
81
|
+
'twitter-minute' |
|
|
82
|
+
'twitter-minute-now' |
|
|
83
|
+
'twitter-first-minute';
|
|
84
|
+
|
|
85
|
+
export type MinTimeFunction = (date: number, options: {
|
|
86
|
+
future: boolean,
|
|
87
|
+
getMinTimeForUnit: (unit: Unit, prevUnit?: Unit) => number | void
|
|
88
|
+
}) => number;
|
|
89
|
+
|
|
90
|
+
export interface Step {
|
|
91
|
+
formatAs?: Unit;
|
|
92
|
+
|
|
93
|
+
minTime?: number | MinTimeFunction;
|
|
94
|
+
|
|
95
|
+
format?(date: DateInput, locale: Locale, options: {
|
|
96
|
+
formatAs: (unit: Unit, value: number) => string,
|
|
97
|
+
now: number,
|
|
98
|
+
future: boolean
|
|
99
|
+
}): string | void;
|
|
100
|
+
|
|
101
|
+
getTimeToNextUpdate?(date: DateInput, options: {
|
|
102
|
+
getTimeToNextUpdateForUnit: (unit: Unit) => number | void,
|
|
103
|
+
now: number,
|
|
104
|
+
future: boolean
|
|
105
|
+
}): number | void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface Style {
|
|
109
|
+
steps: Step[];
|
|
110
|
+
labels: LabelStyleName | LabelStyleName[];
|
|
111
|
+
round?: Rounding;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface FormatOptions {
|
|
115
|
+
now?: number;
|
|
116
|
+
future?: boolean;
|
|
117
|
+
getTimeToNextUpdate?: boolean;
|
|
118
|
+
round?: Rounding;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default class TimeAgo {
|
|
122
|
+
constructor(locale: Locale | Locale[], options?: { polyfill?: boolean });
|
|
123
|
+
format(date: DateInput, style?: FormatStyleName | Style, options?: FormatOptions): string | [string, number?];
|
|
124
|
+
format(date: DateInput, options: FormatOptions): string | [string, number?];
|
|
125
|
+
getLabels(labelsType: LabelStyleName | LabelStyleName[]): Labels;
|
|
126
|
+
static addLocale(localeData: LocaleData): void;
|
|
127
|
+
static addDefaultLocale(localeData: LocaleData): void;
|
|
128
|
+
static setDefaultLocale(locale: Locale): void;
|
|
129
|
+
static addLabels(locale: Locale, name: LabelStyleName, labels: Labels): void;
|
|
130
|
+
}
|
package/load-all-locales.js
CHANGED
|
@@ -15,6 +15,7 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/bs-Cyrl"))
|
|
|
15
15
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ca"))
|
|
16
16
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ccp"))
|
|
17
17
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ce"))
|
|
18
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/ceb"))
|
|
18
19
|
TimeAgo.addLocale(require("javascript-time-ago/locale/chr"))
|
|
19
20
|
TimeAgo.addLocale(require("javascript-time-ago/locale/cs"))
|
|
20
21
|
TimeAgo.addLocale(require("javascript-time-ago/locale/cy"))
|
|
@@ -121,14 +122,33 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/en-ZA"))
|
|
|
121
122
|
TimeAgo.addLocale(require("javascript-time-ago/locale/en-ZM"))
|
|
122
123
|
TimeAgo.addLocale(require("javascript-time-ago/locale/en-ZW"))
|
|
123
124
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es"))
|
|
125
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-419"))
|
|
124
126
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es-AR"))
|
|
127
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-BO"))
|
|
128
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-BR"))
|
|
129
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-BZ"))
|
|
130
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-CL"))
|
|
131
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-CO"))
|
|
132
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-CR"))
|
|
133
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-CU"))
|
|
134
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-DO"))
|
|
135
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-EC"))
|
|
136
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-GT"))
|
|
137
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-HN"))
|
|
125
138
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es-MX"))
|
|
139
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-NI"))
|
|
140
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-PA"))
|
|
141
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-PE"))
|
|
142
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-PR"))
|
|
126
143
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es-PY"))
|
|
127
144
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es-SV"))
|
|
128
145
|
TimeAgo.addLocale(require("javascript-time-ago/locale/es-US"))
|
|
146
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-UY"))
|
|
147
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/es-VE"))
|
|
129
148
|
TimeAgo.addLocale(require("javascript-time-ago/locale/et"))
|
|
130
149
|
TimeAgo.addLocale(require("javascript-time-ago/locale/eu"))
|
|
131
150
|
TimeAgo.addLocale(require("javascript-time-ago/locale/fa"))
|
|
151
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/ff-Adlm"))
|
|
132
152
|
TimeAgo.addLocale(require("javascript-time-ago/locale/fi"))
|
|
133
153
|
TimeAgo.addLocale(require("javascript-time-ago/locale/fil"))
|
|
134
154
|
TimeAgo.addLocale(require("javascript-time-ago/locale/fo"))
|
|
@@ -140,6 +160,7 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/ga"))
|
|
|
140
160
|
TimeAgo.addLocale(require("javascript-time-ago/locale/gd"))
|
|
141
161
|
TimeAgo.addLocale(require("javascript-time-ago/locale/gl"))
|
|
142
162
|
TimeAgo.addLocale(require("javascript-time-ago/locale/gu"))
|
|
163
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/ha"))
|
|
143
164
|
TimeAgo.addLocale(require("javascript-time-ago/locale/he"))
|
|
144
165
|
TimeAgo.addLocale(require("javascript-time-ago/locale/hi"))
|
|
145
166
|
TimeAgo.addLocale(require("javascript-time-ago/locale/hr"))
|
|
@@ -148,6 +169,7 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/hu"))
|
|
|
148
169
|
TimeAgo.addLocale(require("javascript-time-ago/locale/hy"))
|
|
149
170
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ia"))
|
|
150
171
|
TimeAgo.addLocale(require("javascript-time-ago/locale/id"))
|
|
172
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/ig"))
|
|
151
173
|
TimeAgo.addLocale(require("javascript-time-ago/locale/is"))
|
|
152
174
|
TimeAgo.addLocale(require("javascript-time-ago/locale/it"))
|
|
153
175
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ja"))
|
|
@@ -181,10 +203,13 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/nb"))
|
|
|
181
203
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ne"))
|
|
182
204
|
TimeAgo.addLocale(require("javascript-time-ago/locale/nl"))
|
|
183
205
|
TimeAgo.addLocale(require("javascript-time-ago/locale/nn"))
|
|
206
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/no"))
|
|
184
207
|
TimeAgo.addLocale(require("javascript-time-ago/locale/or"))
|
|
185
208
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pa"))
|
|
209
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/pcm"))
|
|
186
210
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pl"))
|
|
187
211
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ps"))
|
|
212
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/ps-PK"))
|
|
188
213
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pt"))
|
|
189
214
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pt-AO"))
|
|
190
215
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pt-CH"))
|
|
@@ -198,6 +223,7 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/pt-PT"))
|
|
|
198
223
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pt-ST"))
|
|
199
224
|
TimeAgo.addLocale(require("javascript-time-ago/locale/pt-TL"))
|
|
200
225
|
TimeAgo.addLocale(require("javascript-time-ago/locale/qu"))
|
|
226
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/rm"))
|
|
201
227
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ro"))
|
|
202
228
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ru"))
|
|
203
229
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sah"))
|
|
@@ -210,16 +236,21 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/sl"))
|
|
|
210
236
|
TimeAgo.addLocale(require("javascript-time-ago/locale/so"))
|
|
211
237
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sq"))
|
|
212
238
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sr"))
|
|
239
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/sr-Cyrl-BA"))
|
|
213
240
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sr-Latn"))
|
|
241
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/sr-Latn-BA"))
|
|
242
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/su"))
|
|
214
243
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sv"))
|
|
215
244
|
TimeAgo.addLocale(require("javascript-time-ago/locale/sw"))
|
|
216
245
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ta"))
|
|
217
246
|
TimeAgo.addLocale(require("javascript-time-ago/locale/te"))
|
|
247
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/tg"))
|
|
218
248
|
TimeAgo.addLocale(require("javascript-time-ago/locale/th"))
|
|
219
249
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ti"))
|
|
220
250
|
TimeAgo.addLocale(require("javascript-time-ago/locale/tk"))
|
|
221
251
|
TimeAgo.addLocale(require("javascript-time-ago/locale/to"))
|
|
222
252
|
TimeAgo.addLocale(require("javascript-time-ago/locale/tr"))
|
|
253
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/tt"))
|
|
223
254
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ug"))
|
|
224
255
|
TimeAgo.addLocale(require("javascript-time-ago/locale/uk"))
|
|
225
256
|
TimeAgo.addLocale(require("javascript-time-ago/locale/ur"))
|
|
@@ -228,7 +259,10 @@ TimeAgo.addLocale(require("javascript-time-ago/locale/uz"))
|
|
|
228
259
|
TimeAgo.addLocale(require("javascript-time-ago/locale/uz-Cyrl"))
|
|
229
260
|
TimeAgo.addLocale(require("javascript-time-ago/locale/vi"))
|
|
230
261
|
TimeAgo.addLocale(require("javascript-time-ago/locale/wae"))
|
|
262
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/wo"))
|
|
231
263
|
TimeAgo.addLocale(require("javascript-time-ago/locale/yi"))
|
|
264
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/yo"))
|
|
265
|
+
TimeAgo.addLocale(require("javascript-time-ago/locale/yo-BJ"))
|
|
232
266
|
TimeAgo.addLocale(require("javascript-time-ago/locale/yue"))
|
|
233
267
|
TimeAgo.addLocale(require("javascript-time-ago/locale/yue-Hans"))
|
|
234
268
|
TimeAgo.addLocale(require("javascript-time-ago/locale/zh"))
|
package/locale/af/index.js
CHANGED
package/locale/af.json
CHANGED
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
},
|
|
93
93
|
"short": {
|
|
94
94
|
"year": {
|
|
95
|
-
"previous": "verlede
|
|
96
|
-
"current": "hierdie
|
|
97
|
-
"next": "volgende
|
|
95
|
+
"previous": "verlede j.",
|
|
96
|
+
"current": "hierdie j.",
|
|
97
|
+
"next": "volgende j.",
|
|
98
98
|
"past": "{0} j. gelede",
|
|
99
99
|
"future": "oor {0} j."
|
|
100
100
|
},
|
|
@@ -106,16 +106,16 @@
|
|
|
106
106
|
"future": "oor {0} kw."
|
|
107
107
|
},
|
|
108
108
|
"month": {
|
|
109
|
-
"previous": "verlede
|
|
110
|
-
"current": "
|
|
111
|
-
"next": "volgende
|
|
109
|
+
"previous": "verlede md.",
|
|
110
|
+
"current": "hierdie md.",
|
|
111
|
+
"next": "volgende md.",
|
|
112
112
|
"past": "{0} md. gelede",
|
|
113
113
|
"future": "oor {0} md."
|
|
114
114
|
},
|
|
115
115
|
"week": {
|
|
116
|
-
"previous": "verlede
|
|
117
|
-
"current": "hierdie
|
|
118
|
-
"next": "volgende
|
|
116
|
+
"previous": "verlede w.",
|
|
117
|
+
"current": "hierdie w.",
|
|
118
|
+
"next": "volgende w.",
|
|
119
119
|
"past": "{0} w. gelede",
|
|
120
120
|
"future": "oor {0} w."
|
|
121
121
|
},
|
|
@@ -152,9 +152,9 @@
|
|
|
152
152
|
},
|
|
153
153
|
"narrow": {
|
|
154
154
|
"year": {
|
|
155
|
-
"previous": "verlede
|
|
156
|
-
"current": "hierdie
|
|
157
|
-
"next": "volgende
|
|
155
|
+
"previous": "verlede j.",
|
|
156
|
+
"current": "hierdie j.",
|
|
157
|
+
"next": "volgende j.",
|
|
158
158
|
"past": "{0} j. gelede",
|
|
159
159
|
"future": "oor {0} j."
|
|
160
160
|
},
|
|
@@ -166,16 +166,16 @@
|
|
|
166
166
|
"future": "oor {0} kw."
|
|
167
167
|
},
|
|
168
168
|
"month": {
|
|
169
|
-
"previous": "verlede
|
|
170
|
-
"current": "
|
|
171
|
-
"next": "volgende
|
|
169
|
+
"previous": "verlede md.",
|
|
170
|
+
"current": "hierdie md.",
|
|
171
|
+
"next": "volgende md.",
|
|
172
172
|
"past": "{0} md. gelede",
|
|
173
173
|
"future": "oor {0} md."
|
|
174
174
|
},
|
|
175
175
|
"week": {
|
|
176
|
-
"previous": "verlede
|
|
177
|
-
"current": "hierdie
|
|
178
|
-
"next": "volgende
|
|
176
|
+
"previous": "verlede w.",
|
|
177
|
+
"current": "hierdie w.",
|
|
178
|
+
"next": "volgende w.",
|
|
179
179
|
"past": "{0} w. gelede",
|
|
180
180
|
"future": "oor {0} w."
|
|
181
181
|
},
|
package/locale/am/index.js
CHANGED
package/locale/ar/index.js
CHANGED
package/locale/ar-AE/index.js
CHANGED
package/locale/as/index.js
CHANGED
package/locale/as.json
CHANGED
package/locale/ast/index.js
CHANGED
package/locale/az/index.js
CHANGED
package/locale/be/index.js
CHANGED
package/locale/be.json
CHANGED
|
@@ -130,9 +130,9 @@
|
|
|
130
130
|
},
|
|
131
131
|
"short": {
|
|
132
132
|
"year": {
|
|
133
|
-
"previous": "у
|
|
133
|
+
"previous": "у мін. годзе",
|
|
134
134
|
"current": "у гэтым годзе",
|
|
135
|
-
"next": "у
|
|
135
|
+
"next": "у наст. годзе",
|
|
136
136
|
"past": "{0} г. таму",
|
|
137
137
|
"future": "праз {0} г."
|
|
138
138
|
},
|
|
@@ -144,16 +144,16 @@
|
|
|
144
144
|
"future": "праз {0} кв."
|
|
145
145
|
},
|
|
146
146
|
"month": {
|
|
147
|
-
"previous": "у
|
|
148
|
-
"current": "у гэтым
|
|
149
|
-
"next": "у
|
|
147
|
+
"previous": "у мін. мес.",
|
|
148
|
+
"current": "у гэтым мес.",
|
|
149
|
+
"next": "у наст. мес.",
|
|
150
150
|
"past": "{0} мес. таму",
|
|
151
151
|
"future": "праз {0} мес."
|
|
152
152
|
},
|
|
153
153
|
"week": {
|
|
154
|
-
"previous": "на
|
|
155
|
-
"current": "на гэтым
|
|
156
|
-
"next": "на
|
|
154
|
+
"previous": "на мін. тыд.",
|
|
155
|
+
"current": "на гэтым тыд.",
|
|
156
|
+
"next": "на наст. тыд.",
|
|
157
157
|
"past": "{0} тыд таму",
|
|
158
158
|
"future": "праз {0} тыд"
|
|
159
159
|
},
|
|
@@ -194,9 +194,9 @@
|
|
|
194
194
|
},
|
|
195
195
|
"narrow": {
|
|
196
196
|
"year": {
|
|
197
|
-
"previous": "у
|
|
197
|
+
"previous": "у мін. годзе",
|
|
198
198
|
"current": "у гэтым годзе",
|
|
199
|
-
"next": "у
|
|
199
|
+
"next": "у наст. годзе",
|
|
200
200
|
"past": "{0} г. таму",
|
|
201
201
|
"future": "праз {0} г."
|
|
202
202
|
},
|
|
@@ -208,16 +208,16 @@
|
|
|
208
208
|
"future": "праз {0} кв."
|
|
209
209
|
},
|
|
210
210
|
"month": {
|
|
211
|
-
"previous": "у
|
|
212
|
-
"current": "у гэтым
|
|
213
|
-
"next": "у
|
|
211
|
+
"previous": "у мін. мес.",
|
|
212
|
+
"current": "у гэтым мес.",
|
|
213
|
+
"next": "у наст. мес.",
|
|
214
214
|
"past": "{0} мес. таму",
|
|
215
215
|
"future": "праз {0} мес."
|
|
216
216
|
},
|
|
217
217
|
"week": {
|
|
218
|
-
"previous": "на
|
|
219
|
-
"current": "на гэтым
|
|
220
|
-
"next": "на
|
|
218
|
+
"previous": "на мін. тыд.",
|
|
219
|
+
"current": "на гэтым тыд.",
|
|
220
|
+
"next": "на наст. тыд.",
|
|
221
221
|
"past": "{0} тыд таму",
|
|
222
222
|
"future": "праз {0} тыд"
|
|
223
223
|
},
|
package/locale/bg/index.js
CHANGED