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.
Files changed (494) hide show
  1. package/README.md +22 -12
  2. package/bin/generate-locale-messages.js +5 -1
  3. package/bundle/javascript-time-ago.js +1 -1
  4. package/bundle/javascript-time-ago.js.map +1 -1
  5. package/bundle/javascript-time-ago.min.js +1 -1
  6. package/bundle/javascript-time-ago.min.js.map +1 -1
  7. package/commonjs/TimeAgo.js +1 -1
  8. package/commonjs/TimeAgo.js.map +1 -1
  9. package/index.d.ts +130 -0
  10. package/load-all-locales.js +34 -0
  11. package/locale/af/index.js +3 -1
  12. package/locale/af.json +18 -18
  13. package/locale/am/index.js +3 -1
  14. package/locale/ar/index.js +3 -1
  15. package/locale/ar-AE/index.js +3 -1
  16. package/locale/as/index.js +3 -1
  17. package/locale/as.json +2 -2
  18. package/locale/ast/index.js +3 -1
  19. package/locale/az/index.js +3 -1
  20. package/locale/be/index.js +3 -1
  21. package/locale/be.json +16 -16
  22. package/locale/bg/index.js +3 -1
  23. package/locale/bg.json +1 -1
  24. package/locale/bn/index.js +3 -1
  25. package/locale/br/index.js +3 -1
  26. package/locale/br.json +16 -28
  27. package/locale/bs/index.js +3 -1
  28. package/locale/bs-Cyrl/index.js +3 -1
  29. package/locale/bs-Cyrl.json +105 -140
  30. package/locale/ca/index.js +3 -1
  31. package/locale/ca.json +4 -4
  32. package/locale/ccp/index.js +3 -1
  33. package/locale/ce/index.js +3 -1
  34. package/locale/ceb/index.js +3 -0
  35. package/locale/ceb.json +159 -0
  36. package/locale/chr/index.js +3 -1
  37. package/locale/chr.json +18 -18
  38. package/locale/cs/index.js +3 -1
  39. package/locale/cy/index.js +3 -1
  40. package/locale/cy.json +85 -30
  41. package/locale/da/index.js +3 -1
  42. package/locale/da.json +30 -30
  43. package/locale/de/index.js +3 -1
  44. package/locale/dsb/index.js +3 -1
  45. package/locale/dz/index.js +3 -1
  46. package/locale/ee/index.js +3 -1
  47. package/locale/el/index.js +3 -1
  48. package/locale/el.json +19 -9
  49. package/locale/en/index.js +3 -1
  50. package/locale/en-001/index.js +3 -1
  51. package/locale/en-001.json +18 -18
  52. package/locale/en-150/index.js +3 -1
  53. package/locale/en-150.json +18 -18
  54. package/locale/en-AG/index.js +3 -1
  55. package/locale/en-AG.json +18 -18
  56. package/locale/en-AI/index.js +3 -1
  57. package/locale/en-AI.json +18 -18
  58. package/locale/en-AT/index.js +3 -1
  59. package/locale/en-AT.json +18 -18
  60. package/locale/en-AU/index.js +3 -1
  61. package/locale/en-AU.json +18 -18
  62. package/locale/en-BB/index.js +3 -1
  63. package/locale/en-BB.json +18 -18
  64. package/locale/en-BE/index.js +3 -1
  65. package/locale/en-BE.json +18 -18
  66. package/locale/en-BM/index.js +3 -1
  67. package/locale/en-BM.json +18 -18
  68. package/locale/en-BS/index.js +3 -1
  69. package/locale/en-BS.json +18 -18
  70. package/locale/en-BW/index.js +3 -1
  71. package/locale/en-BW.json +18 -18
  72. package/locale/en-BZ/index.js +3 -1
  73. package/locale/en-BZ.json +18 -18
  74. package/locale/en-CA/index.js +3 -1
  75. package/locale/en-CA.json +18 -18
  76. package/locale/en-CC/index.js +3 -1
  77. package/locale/en-CC.json +18 -18
  78. package/locale/en-CH/index.js +3 -1
  79. package/locale/en-CH.json +18 -18
  80. package/locale/en-CK/index.js +3 -1
  81. package/locale/en-CK.json +18 -18
  82. package/locale/en-CM/index.js +3 -1
  83. package/locale/en-CM.json +18 -18
  84. package/locale/en-CX/index.js +3 -1
  85. package/locale/en-CX.json +18 -18
  86. package/locale/en-CY/index.js +3 -1
  87. package/locale/en-CY.json +18 -18
  88. package/locale/en-DE/index.js +3 -1
  89. package/locale/en-DE.json +18 -18
  90. package/locale/en-DG/index.js +3 -1
  91. package/locale/en-DG.json +18 -18
  92. package/locale/en-DK/index.js +3 -1
  93. package/locale/en-DK.json +18 -18
  94. package/locale/en-DM/index.js +3 -1
  95. package/locale/en-DM.json +18 -18
  96. package/locale/en-ER/index.js +3 -1
  97. package/locale/en-ER.json +18 -18
  98. package/locale/en-FI/index.js +3 -1
  99. package/locale/en-FI.json +18 -18
  100. package/locale/en-FJ/index.js +3 -1
  101. package/locale/en-FJ.json +18 -18
  102. package/locale/en-FK/index.js +3 -1
  103. package/locale/en-FK.json +18 -18
  104. package/locale/en-FM/index.js +3 -1
  105. package/locale/en-FM.json +18 -18
  106. package/locale/en-GB/index.js +3 -1
  107. package/locale/en-GB.json +18 -18
  108. package/locale/en-GD/index.js +3 -1
  109. package/locale/en-GD.json +18 -18
  110. package/locale/en-GG/index.js +3 -1
  111. package/locale/en-GG.json +18 -18
  112. package/locale/en-GH/index.js +3 -1
  113. package/locale/en-GH.json +18 -18
  114. package/locale/en-GI/index.js +3 -1
  115. package/locale/en-GI.json +18 -18
  116. package/locale/en-GM/index.js +3 -1
  117. package/locale/en-GM.json +18 -18
  118. package/locale/en-GY/index.js +3 -1
  119. package/locale/en-GY.json +18 -18
  120. package/locale/en-HK/index.js +3 -1
  121. package/locale/en-HK.json +18 -18
  122. package/locale/en-IE/index.js +3 -1
  123. package/locale/en-IE.json +18 -18
  124. package/locale/en-IL/index.js +3 -1
  125. package/locale/en-IL.json +18 -18
  126. package/locale/en-IM/index.js +3 -1
  127. package/locale/en-IM.json +18 -18
  128. package/locale/en-IN/index.js +3 -1
  129. package/locale/en-IN.json +18 -18
  130. package/locale/en-IO/index.js +3 -1
  131. package/locale/en-IO.json +18 -18
  132. package/locale/en-JE/index.js +3 -1
  133. package/locale/en-JE.json +18 -18
  134. package/locale/en-JM/index.js +3 -1
  135. package/locale/en-JM.json +18 -18
  136. package/locale/en-KE/index.js +3 -1
  137. package/locale/en-KE.json +18 -18
  138. package/locale/en-KI/index.js +3 -1
  139. package/locale/en-KI.json +18 -18
  140. package/locale/en-KN/index.js +3 -1
  141. package/locale/en-KN.json +18 -18
  142. package/locale/en-KY/index.js +3 -1
  143. package/locale/en-KY.json +18 -18
  144. package/locale/en-LC/index.js +3 -1
  145. package/locale/en-LC.json +18 -18
  146. package/locale/en-LR/index.js +3 -1
  147. package/locale/en-LR.json +18 -18
  148. package/locale/en-LS/index.js +3 -1
  149. package/locale/en-LS.json +18 -18
  150. package/locale/en-MG/index.js +3 -1
  151. package/locale/en-MG.json +18 -18
  152. package/locale/en-MO/index.js +3 -1
  153. package/locale/en-MO.json +18 -18
  154. package/locale/en-MS/index.js +3 -1
  155. package/locale/en-MS.json +18 -18
  156. package/locale/en-MT/index.js +3 -1
  157. package/locale/en-MT.json +18 -18
  158. package/locale/en-MU/index.js +3 -1
  159. package/locale/en-MU.json +18 -18
  160. package/locale/en-MW/index.js +3 -1
  161. package/locale/en-MW.json +18 -18
  162. package/locale/en-MY/index.js +3 -1
  163. package/locale/en-MY.json +18 -18
  164. package/locale/en-NA/index.js +3 -1
  165. package/locale/en-NA.json +18 -18
  166. package/locale/en-NF/index.js +3 -1
  167. package/locale/en-NF.json +18 -18
  168. package/locale/en-NG/index.js +3 -1
  169. package/locale/en-NG.json +18 -18
  170. package/locale/en-NL/index.js +3 -1
  171. package/locale/en-NL.json +18 -18
  172. package/locale/en-NR/index.js +3 -1
  173. package/locale/en-NR.json +18 -18
  174. package/locale/en-NU/index.js +3 -1
  175. package/locale/en-NU.json +18 -18
  176. package/locale/en-NZ/index.js +3 -1
  177. package/locale/en-NZ.json +18 -18
  178. package/locale/en-PG/index.js +3 -1
  179. package/locale/en-PG.json +18 -18
  180. package/locale/en-PH/index.js +3 -1
  181. package/locale/en-PH.json +18 -18
  182. package/locale/en-PK/index.js +3 -1
  183. package/locale/en-PK.json +18 -18
  184. package/locale/en-PN/index.js +3 -1
  185. package/locale/en-PN.json +18 -18
  186. package/locale/en-PW/index.js +3 -1
  187. package/locale/en-PW.json +18 -18
  188. package/locale/en-RW/index.js +3 -1
  189. package/locale/en-RW.json +18 -18
  190. package/locale/en-SB/index.js +3 -1
  191. package/locale/en-SB.json +18 -18
  192. package/locale/en-SC/index.js +3 -1
  193. package/locale/en-SC.json +18 -18
  194. package/locale/en-SD/index.js +3 -1
  195. package/locale/en-SD.json +18 -18
  196. package/locale/en-SE/index.js +3 -1
  197. package/locale/en-SE.json +18 -18
  198. package/locale/en-SG/index.js +3 -1
  199. package/locale/en-SG.json +3 -3
  200. package/locale/en-SH/index.js +3 -1
  201. package/locale/en-SH.json +18 -18
  202. package/locale/en-SI/index.js +3 -1
  203. package/locale/en-SI.json +18 -18
  204. package/locale/en-SL/index.js +3 -1
  205. package/locale/en-SL.json +18 -18
  206. package/locale/en-SS/index.js +3 -1
  207. package/locale/en-SS.json +18 -18
  208. package/locale/en-SX/index.js +3 -1
  209. package/locale/en-SX.json +18 -18
  210. package/locale/en-SZ/index.js +3 -1
  211. package/locale/en-SZ.json +18 -18
  212. package/locale/en-TC/index.js +3 -1
  213. package/locale/en-TC.json +18 -18
  214. package/locale/en-TK/index.js +3 -1
  215. package/locale/en-TK.json +18 -18
  216. package/locale/en-TO/index.js +3 -1
  217. package/locale/en-TO.json +18 -18
  218. package/locale/en-TT/index.js +3 -1
  219. package/locale/en-TT.json +18 -18
  220. package/locale/en-TV/index.js +3 -1
  221. package/locale/en-TV.json +18 -18
  222. package/locale/en-TZ/index.js +3 -1
  223. package/locale/en-TZ.json +18 -18
  224. package/locale/en-UG/index.js +3 -1
  225. package/locale/en-UG.json +18 -18
  226. package/locale/en-VC/index.js +3 -1
  227. package/locale/en-VC.json +18 -18
  228. package/locale/en-VG/index.js +3 -1
  229. package/locale/en-VG.json +18 -18
  230. package/locale/en-VU/index.js +3 -1
  231. package/locale/en-VU.json +18 -18
  232. package/locale/en-WS/index.js +3 -1
  233. package/locale/en-WS.json +18 -18
  234. package/locale/en-ZA/index.js +3 -1
  235. package/locale/en-ZA.json +18 -18
  236. package/locale/en-ZM/index.js +3 -1
  237. package/locale/en-ZM.json +18 -18
  238. package/locale/en-ZW/index.js +3 -1
  239. package/locale/en-ZW.json +18 -18
  240. package/locale/en.json +27 -17
  241. package/locale/es/index.js +3 -1
  242. package/locale/es-419/index.js +3 -0
  243. package/locale/es-419.json +225 -0
  244. package/locale/es-AR/index.js +3 -1
  245. package/locale/es-AR.json +6 -6
  246. package/locale/es-BO/index.js +3 -0
  247. package/locale/es-BO.json +225 -0
  248. package/locale/es-BR/index.js +3 -0
  249. package/locale/es-BR.json +225 -0
  250. package/locale/es-BZ/index.js +3 -0
  251. package/locale/es-BZ.json +225 -0
  252. package/locale/es-CL/index.js +3 -0
  253. package/locale/es-CL.json +225 -0
  254. package/locale/es-CO/index.js +3 -0
  255. package/locale/es-CO.json +225 -0
  256. package/locale/es-CR/index.js +3 -0
  257. package/locale/es-CR.json +225 -0
  258. package/locale/es-CU/index.js +3 -0
  259. package/locale/es-CU.json +225 -0
  260. package/locale/es-DO/index.js +3 -0
  261. package/locale/es-DO.json +225 -0
  262. package/locale/es-EC/index.js +3 -0
  263. package/locale/es-EC.json +225 -0
  264. package/locale/es-GT/index.js +3 -0
  265. package/locale/es-GT.json +225 -0
  266. package/locale/es-HN/index.js +3 -0
  267. package/locale/es-HN.json +225 -0
  268. package/locale/es-MX/index.js +3 -1
  269. package/locale/es-MX.json +18 -18
  270. package/locale/es-NI/index.js +3 -0
  271. package/locale/es-NI.json +225 -0
  272. package/locale/es-PA/index.js +3 -0
  273. package/locale/es-PA.json +225 -0
  274. package/locale/es-PE/index.js +3 -0
  275. package/locale/es-PE.json +225 -0
  276. package/locale/es-PR/index.js +3 -0
  277. package/locale/es-PR.json +225 -0
  278. package/locale/es-PY/index.js +3 -1
  279. package/locale/es-PY.json +6 -6
  280. package/locale/es-SV/index.js +3 -1
  281. package/locale/es-SV.json +6 -6
  282. package/locale/es-US/index.js +3 -1
  283. package/locale/es-US.json +6 -6
  284. package/locale/es-UY/index.js +3 -0
  285. package/locale/es-UY.json +225 -0
  286. package/locale/es-VE/index.js +3 -0
  287. package/locale/es-VE.json +225 -0
  288. package/locale/es.json +16 -6
  289. package/locale/et/index.js +3 -1
  290. package/locale/et.json +18 -18
  291. package/locale/eu/index.js +3 -1
  292. package/locale/fa/index.js +3 -1
  293. package/locale/fa.json +2 -2
  294. package/locale/ff-Adlm/index.js +3 -0
  295. package/locale/ff-Adlm.json +279 -0
  296. package/locale/fi/index.js +3 -1
  297. package/locale/fil/index.js +3 -1
  298. package/locale/fo/index.js +3 -1
  299. package/locale/fo.json +12 -12
  300. package/locale/fr/index.js +3 -1
  301. package/locale/fr-CA/index.js +3 -1
  302. package/locale/fr-CA.json +4 -4
  303. package/locale/fur/index.js +3 -1
  304. package/locale/fy/index.js +3 -1
  305. package/locale/ga/index.js +3 -1
  306. package/locale/ga.json +3 -5
  307. package/locale/gd/index.js +3 -1
  308. package/locale/gd.json +4 -4
  309. package/locale/gl/index.js +3 -1
  310. package/locale/gl.json +14 -14
  311. package/locale/gu/index.js +3 -1
  312. package/locale/ha/index.js +3 -0
  313. package/locale/ha.json +222 -0
  314. package/locale/he/index.js +3 -1
  315. package/locale/hi/index.js +3 -1
  316. package/locale/hi.json +9 -15
  317. package/locale/hr/index.js +3 -1
  318. package/locale/hsb/index.js +3 -1
  319. package/locale/hu/index.js +3 -1
  320. package/locale/hy/index.js +3 -1
  321. package/locale/hy.json +3 -3
  322. package/locale/ia/index.js +3 -1
  323. package/locale/ia.json +132 -48
  324. package/locale/id/index.js +3 -1
  325. package/locale/id.json +18 -18
  326. package/locale/ig/index.js +3 -0
  327. package/locale/ig.json +159 -0
  328. package/locale/is/index.js +3 -1
  329. package/locale/it/index.js +3 -1
  330. package/locale/it.json +8 -14
  331. package/locale/ja/index.js +3 -1
  332. package/locale/ja.json +9 -9
  333. package/locale/jgo/index.js +3 -1
  334. package/locale/jv/index.js +3 -1
  335. package/locale/jv.json +69 -69
  336. package/locale/ka/index.js +3 -1
  337. package/locale/kea/index.js +3 -1
  338. package/locale/kea.json +21 -21
  339. package/locale/kk/index.js +3 -1
  340. package/locale/kl/index.js +3 -1
  341. package/locale/km/index.js +3 -1
  342. package/locale/kn/index.js +3 -1
  343. package/locale/ko/index.js +3 -1
  344. package/locale/ko.json +11 -0
  345. package/locale/kok/index.js +3 -1
  346. package/locale/kok.json +1 -1
  347. package/locale/ksh/index.js +3 -1
  348. package/locale/ku/index.js +3 -1
  349. package/locale/ku.json +44 -26
  350. package/locale/ky/index.js +3 -1
  351. package/locale/lb/index.js +3 -1
  352. package/locale/lkt/index.js +3 -1
  353. package/locale/lo/index.js +3 -1
  354. package/locale/lo.json +1 -1
  355. package/locale/lt/index.js +3 -1
  356. package/locale/lv/index.js +3 -1
  357. package/locale/lv.json +18 -18
  358. package/locale/mk/index.js +3 -1
  359. package/locale/mk.json +6 -6
  360. package/locale/ml/index.js +3 -1
  361. package/locale/mn/index.js +3 -1
  362. package/locale/mn.json +6 -6
  363. package/locale/mr/index.js +3 -1
  364. package/locale/ms/index.js +3 -1
  365. package/locale/ms.json +7 -7
  366. package/locale/mt/index.js +3 -1
  367. package/locale/my/index.js +3 -1
  368. package/locale/mzn/index.js +3 -1
  369. package/locale/nb/index.js +3 -1
  370. package/locale/ne/index.js +3 -1
  371. package/locale/ne.json +4 -4
  372. package/locale/nl/index.js +3 -1
  373. package/locale/nn/index.js +3 -1
  374. package/locale/nn.json +26 -26
  375. package/locale/no/index.js +3 -0
  376. package/locale/no.json +201 -0
  377. package/locale/or/index.js +3 -1
  378. package/locale/or.json +5 -5
  379. package/locale/pa/index.js +3 -1
  380. package/locale/pcm/index.js +3 -0
  381. package/locale/pcm.json +159 -0
  382. package/locale/pl/index.js +3 -1
  383. package/locale/pl.json +14 -14
  384. package/locale/ps/index.js +3 -1
  385. package/locale/ps-PK/index.js +3 -0
  386. package/locale/ps-PK.json +240 -0
  387. package/locale/ps.json +157 -94
  388. package/locale/pt/index.js +3 -1
  389. package/locale/pt-AO/index.js +3 -1
  390. package/locale/pt-AO.json +4 -1
  391. package/locale/pt-CH/index.js +3 -1
  392. package/locale/pt-CH.json +4 -1
  393. package/locale/pt-CV/index.js +3 -1
  394. package/locale/pt-CV.json +4 -1
  395. package/locale/pt-GQ/index.js +3 -1
  396. package/locale/pt-GQ.json +4 -1
  397. package/locale/pt-GW/index.js +3 -1
  398. package/locale/pt-GW.json +4 -1
  399. package/locale/pt-LU/index.js +3 -1
  400. package/locale/pt-LU.json +4 -1
  401. package/locale/pt-MO/index.js +3 -1
  402. package/locale/pt-MO.json +4 -1
  403. package/locale/pt-MZ/index.js +3 -1
  404. package/locale/pt-MZ.json +4 -1
  405. package/locale/pt-PT/index.js +3 -1
  406. package/locale/pt-PT.json +4 -1
  407. package/locale/pt-ST/index.js +3 -1
  408. package/locale/pt-ST.json +4 -1
  409. package/locale/pt-TL/index.js +3 -1
  410. package/locale/pt-TL.json +4 -1
  411. package/locale/pt.json +2 -5
  412. package/locale/qu/index.js +3 -1
  413. package/locale/rm/index.js +3 -0
  414. package/locale/rm.json +165 -0
  415. package/locale/ro/index.js +3 -1
  416. package/locale/ro.json +1 -1
  417. package/locale/ru/index.js +3 -1
  418. package/locale/ru.json +36 -39
  419. package/locale/sah/index.js +3 -1
  420. package/locale/sd/index.js +3 -1
  421. package/locale/sd.json +6 -6
  422. package/locale/se/index.js +3 -1
  423. package/locale/se-FI/index.js +3 -1
  424. package/locale/si/index.js +3 -1
  425. package/locale/sk/index.js +3 -1
  426. package/locale/sl/index.js +3 -1
  427. package/locale/so/index.js +3 -1
  428. package/locale/so.json +137 -83
  429. package/locale/sq/index.js +3 -1
  430. package/locale/sr/index.js +3 -1
  431. package/locale/sr-Cyrl-BA/index.js +3 -0
  432. package/locale/sr-Cyrl-BA.json +214 -0
  433. package/locale/sr-Latn/index.js +3 -1
  434. package/locale/sr-Latn-BA/index.js +3 -0
  435. package/locale/sr-Latn-BA.json +214 -0
  436. package/locale/su/index.js +3 -0
  437. package/locale/su.json +159 -0
  438. package/locale/sv/index.js +3 -1
  439. package/locale/sw/index.js +3 -1
  440. package/locale/ta/index.js +3 -1
  441. package/locale/te/index.js +3 -1
  442. package/locale/te.json +6 -6
  443. package/locale/tg/index.js +3 -0
  444. package/locale/tg.json +159 -0
  445. package/locale/th/index.js +3 -1
  446. package/locale/ti/index.js +3 -1
  447. package/locale/ti.json +2 -2
  448. package/locale/tk/index.js +3 -1
  449. package/locale/to/index.js +3 -1
  450. package/locale/to.json +6 -6
  451. package/locale/tr/index.js +3 -1
  452. package/locale/tr.json +12 -12
  453. package/locale/tt/index.js +3 -0
  454. package/locale/tt.json +159 -0
  455. package/locale/ug/index.js +3 -1
  456. package/locale/uk/index.js +3 -1
  457. package/locale/uk.json +9 -9
  458. package/locale/ur/index.js +3 -1
  459. package/locale/ur-IN/index.js +3 -1
  460. package/locale/ur-IN.json +4 -7
  461. package/locale/ur.json +8 -11
  462. package/locale/uz/index.js +3 -1
  463. package/locale/uz-Cyrl/index.js +3 -1
  464. package/locale/uz.json +6 -6
  465. package/locale/vi/index.js +3 -1
  466. package/locale/vi.json +6 -6
  467. package/locale/wae/index.js +3 -1
  468. package/locale/wo/index.js +3 -0
  469. package/locale/wo.json +159 -0
  470. package/locale/yi/index.js +3 -1
  471. package/locale/yo/index.js +3 -0
  472. package/locale/yo-BJ/index.js +3 -0
  473. package/locale/yo-BJ.json +165 -0
  474. package/locale/yo.json +165 -0
  475. package/locale/yue/index.js +3 -1
  476. package/locale/yue-Hans/index.js +3 -1
  477. package/locale/zh/index.js +3 -1
  478. package/locale/zh-Hans-HK/index.js +3 -1
  479. package/locale/zh-Hans-MO/index.js +3 -1
  480. package/locale/zh-Hans-SG/index.js +3 -1
  481. package/locale/zh-Hant/index.js +3 -1
  482. package/locale/zh-Hant-HK/index.js +3 -1
  483. package/locale/zh-Hant-MO/index.js +3 -1
  484. package/locale/zu/index.js +3 -1
  485. package/locale-more-styles/ckb/long-time.json +9 -0
  486. package/locale-more-styles/ckb/mini.json +9 -0
  487. package/locale-more-styles/ckb/now.json +7 -0
  488. package/locale-more-styles/ckb/short-time.json +12 -0
  489. package/locale-more-styles/hi/mini.json +2 -8
  490. package/locale-more-styles/ru/mini.json +2 -8
  491. package/modules/TimeAgo.js +1 -1
  492. package/modules/TimeAgo.js.map +1 -1
  493. package/package.json +7 -7
  494. package/index.d.ts.test +0 -47
@@ -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
 
@@ -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;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,KAAK,GAAG,CACb,KADa,EAEb;AACA,QAHa,EAIb,QAJa,EAKb,MALa,EAMb,KANa,EAO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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"],"mappings":";;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,KAAK,GAAG,CACb,KADa,EAEb;AACA,QAHa,EAIb,QA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rD,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
+ }
@@ -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"))
@@ -1 +1,3 @@
1
- module.exports = require('../af.json')
1
+ var localeData = require('../af.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
package/locale/af.json CHANGED
@@ -92,9 +92,9 @@
92
92
  },
93
93
  "short": {
94
94
  "year": {
95
- "previous": "verlede jaar",
96
- "current": "hierdie jaar",
97
- "next": "volgende jaar",
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 maand",
110
- "current": "vandeesmaand",
111
- "next": "volgende maand",
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 week",
117
- "current": "hierdie week",
118
- "next": "volgende week",
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 jaar",
156
- "current": "hierdie jaar",
157
- "next": "volgende jaar",
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 maand",
170
- "current": "vandeesmaand",
171
- "next": "volgende maand",
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 week",
177
- "current": "hierdie week",
178
- "next": "volgende week",
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
  },
@@ -1 +1,3 @@
1
- module.exports = require('../am.json')
1
+ var localeData = require('../am.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
@@ -1 +1,3 @@
1
- module.exports = require('../ar.json')
1
+ var localeData = require('../ar.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
@@ -1 +1,3 @@
1
- module.exports = require('../ar-AE.json')
1
+ var localeData = require('../ar-AE.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
@@ -1 +1,3 @@
1
- module.exports = require('../as.json')
1
+ var localeData = require('../as.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
package/locale/as.json CHANGED
@@ -124,8 +124,8 @@
124
124
  "future": "{0} তিনি মাহত"
125
125
  },
126
126
  "month": {
127
- "previous": "যোৱা মাহ",
128
- "current": "এই মাহ",
127
+ "previous": "যোৱা মা.",
128
+ "current": "এই মা.",
129
129
  "next": "অহা মাহ",
130
130
  "past": "{0} মাহ পূৰ্বে",
131
131
  "future": "{0} মাহত"
@@ -1 +1,3 @@
1
- module.exports = require('../ast.json')
1
+ var localeData = require('../ast.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
@@ -1 +1,3 @@
1
- module.exports = require('../az.json')
1
+ var localeData = require('../az.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
@@ -1 +1,3 @@
1
- module.exports = require('../be.json')
1
+ var localeData = require('../be.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData
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
  },
@@ -1 +1,3 @@
1
- module.exports = require('../bg.json')
1
+ var localeData = require('../bg.json')
2
+ exports = module.exports = localeData
3
+ exports['default'] = localeData