chrono-node 2.9.2 → 2.10.1

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 (319) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/locales/en/constants.d.ts +1 -1
  3. package/dist/cjs/locales/en/constants.js +1 -1
  4. package/dist/cjs/locales/en/constants.js.map +1 -1
  5. package/dist/cjs/locales/en/parsers/ENMonthNameMiddleEndianParser.js +1 -1
  6. package/dist/cjs/locales/en/parsers/ENMonthNameMiddleEndianParser.js.map +1 -1
  7. package/dist/cjs/locales/fr/constants.js +13 -0
  8. package/dist/cjs/locales/fr/constants.js.map +1 -1
  9. package/dist/cjs/locales/it/configuration.d.ts +5 -0
  10. package/dist/cjs/locales/it/configuration.js +66 -0
  11. package/dist/cjs/locales/it/configuration.js.map +1 -0
  12. package/dist/cjs/locales/it/constants.d.ts +8 -4
  13. package/dist/cjs/locales/it/constants.js +216 -90
  14. package/dist/cjs/locales/it/constants.js.map +1 -1
  15. package/dist/cjs/locales/it/index.d.ts +9 -7
  16. package/dist/cjs/locales/it/index.js +13 -51
  17. package/dist/cjs/locales/it/index.js.map +1 -1
  18. package/dist/cjs/locales/it/parsers/ITCasualDateParser.js +19 -10
  19. package/dist/cjs/locales/it/parsers/ITCasualDateParser.js.map +1 -1
  20. package/dist/cjs/locales/it/parsers/ITCasualTimeParser.d.ts +1 -1
  21. package/dist/cjs/locales/it/parsers/ITCasualTimeParser.js +70 -37
  22. package/dist/cjs/locales/it/parsers/ITCasualTimeParser.js.map +1 -1
  23. package/dist/cjs/locales/it/parsers/ITMonthNameLittleEndianParser.d.ts +1 -1
  24. package/dist/cjs/locales/it/parsers/ITMonthNameLittleEndianParser.js +6 -6
  25. package/dist/cjs/locales/it/parsers/ITMonthNameLittleEndianParser.js.map +1 -1
  26. package/dist/cjs/locales/it/parsers/ITMonthNameMiddleEndianParser.d.ts +4 -2
  27. package/dist/cjs/locales/it/parsers/ITMonthNameMiddleEndianParser.js +17 -6
  28. package/dist/cjs/locales/it/parsers/ITMonthNameMiddleEndianParser.js.map +1 -1
  29. package/dist/cjs/locales/it/parsers/ITMonthNameParser.d.ts +2 -2
  30. package/dist/cjs/locales/it/parsers/ITMonthNameParser.js +5 -4
  31. package/dist/cjs/locales/it/parsers/ITMonthNameParser.js.map +1 -1
  32. package/dist/cjs/locales/it/parsers/ITRelativeDateFormatParser.js +21 -7
  33. package/dist/cjs/locales/it/parsers/ITRelativeDateFormatParser.js.map +1 -1
  34. package/dist/cjs/locales/it/parsers/ITSlashMonthFormatParser.d.ts +1 -1
  35. package/dist/cjs/locales/it/parsers/ITSlashMonthFormatParser.js +2 -2
  36. package/dist/cjs/locales/it/parsers/ITTimeExpressionParser.d.ts +3 -2
  37. package/dist/cjs/locales/it/parsers/ITTimeExpressionParser.js +37 -29
  38. package/dist/cjs/locales/it/parsers/ITTimeExpressionParser.js.map +1 -1
  39. package/dist/cjs/locales/it/parsers/ITTimeUnitAgoFormatParser.d.ts +1 -1
  40. package/dist/cjs/locales/it/parsers/ITTimeUnitAgoFormatParser.js +9 -7
  41. package/dist/cjs/locales/it/parsers/ITTimeUnitAgoFormatParser.js.map +1 -1
  42. package/dist/cjs/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.d.ts +3 -1
  43. package/dist/cjs/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.js +17 -9
  44. package/dist/cjs/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.js.map +1 -1
  45. package/dist/cjs/locales/it/parsers/ITTimeUnitLaterFormatParser.d.ts +1 -1
  46. package/dist/cjs/locales/it/parsers/ITTimeUnitLaterFormatParser.js +9 -6
  47. package/dist/cjs/locales/it/parsers/ITTimeUnitLaterFormatParser.js.map +1 -1
  48. package/dist/cjs/locales/it/parsers/ITTimeUnitWithinFormatParser.d.ts +3 -1
  49. package/dist/cjs/locales/it/parsers/ITTimeUnitWithinFormatParser.js +21 -6
  50. package/dist/cjs/locales/it/parsers/ITTimeUnitWithinFormatParser.js.map +1 -1
  51. package/dist/cjs/locales/it/parsers/ITWeekdayParser.d.ts +1 -1
  52. package/dist/cjs/locales/it/parsers/ITWeekdayParser.js +21 -12
  53. package/dist/cjs/locales/it/parsers/ITWeekdayParser.js.map +1 -1
  54. package/dist/cjs/locales/it/parsers/{ITCasualYearMonthDayParser.d.ts → ITYearMonthDayParser.d.ts} +3 -1
  55. package/dist/cjs/locales/it/parsers/{ITCasualYearMonthDayParser.js → ITYearMonthDayParser.js} +20 -8
  56. package/dist/cjs/locales/it/parsers/ITYearMonthDayParser.js.map +1 -0
  57. package/dist/cjs/locales/it/refiners/ITExtractYearSuffixRefiner.d.ts +5 -0
  58. package/dist/cjs/locales/it/refiners/ITExtractYearSuffixRefiner.js +34 -0
  59. package/dist/cjs/locales/it/refiners/ITExtractYearSuffixRefiner.js.map +1 -0
  60. package/dist/cjs/locales/it/refiners/ITMergeDateRangeRefiner.d.ts +1 -1
  61. package/dist/cjs/locales/it/refiners/ITMergeDateRangeRefiner.js +3 -3
  62. package/dist/cjs/locales/it/refiners/ITMergeDateRangeRefiner.js.map +1 -1
  63. package/dist/cjs/locales/it/refiners/ITMergeDateTimeRefiner.d.ts +1 -1
  64. package/dist/cjs/locales/it/refiners/ITMergeDateTimeRefiner.js +3 -3
  65. package/dist/cjs/locales/it/refiners/ITMergeDateTimeRefiner.js.map +1 -1
  66. package/dist/cjs/locales/it/refiners/ITMergeRelativeAfterDateRefiner.d.ts +6 -0
  67. package/dist/cjs/locales/it/refiners/ITMergeRelativeAfterDateRefiner.js +30 -0
  68. package/dist/cjs/locales/it/refiners/ITMergeRelativeAfterDateRefiner.js.map +1 -0
  69. package/dist/cjs/locales/it/refiners/{ITMergeRelativeDateRefiner.d.ts → ITMergeRelativeFollowByDateRefiner.d.ts} +1 -1
  70. package/dist/cjs/locales/it/refiners/{ITMergeRelativeDateRefiner.js → ITMergeRelativeFollowByDateRefiner.js} +8 -8
  71. package/dist/cjs/locales/it/refiners/ITMergeRelativeFollowByDateRefiner.js.map +1 -0
  72. package/dist/cjs/locales/it/refiners/ITUnlikelyFormatFilter.d.ts +6 -0
  73. package/dist/cjs/locales/it/refiners/ITUnlikelyFormatFilter.js +26 -0
  74. package/dist/cjs/locales/it/refiners/ITUnlikelyFormatFilter.js.map +1 -0
  75. package/dist/cjs/results.js +15 -9
  76. package/dist/cjs/results.js.map +1 -1
  77. package/dist/esm/locales/en/constants.d.ts +1 -1
  78. package/dist/esm/locales/en/constants.js +1 -1
  79. package/dist/esm/locales/en/constants.js.map +1 -1
  80. package/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js +1 -1
  81. package/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js.map +1 -1
  82. package/dist/esm/locales/fr/constants.js +13 -0
  83. package/dist/esm/locales/fr/constants.js.map +1 -1
  84. package/dist/esm/locales/it/configuration.d.ts +5 -0
  85. package/dist/esm/locales/it/configuration.js +60 -0
  86. package/dist/esm/locales/it/configuration.js.map +1 -0
  87. package/dist/esm/locales/it/constants.d.ts +8 -4
  88. package/dist/esm/locales/it/constants.js +256 -117
  89. package/dist/esm/locales/it/constants.js.map +1 -1
  90. package/dist/esm/locales/it/index.d.ts +9 -7
  91. package/dist/esm/locales/it/index.js +8 -48
  92. package/dist/esm/locales/it/index.js.map +1 -1
  93. package/dist/esm/locales/it/parsers/ITCasualDateParser.js +19 -10
  94. package/dist/esm/locales/it/parsers/ITCasualDateParser.js.map +1 -1
  95. package/dist/esm/locales/it/parsers/ITCasualTimeParser.d.ts +1 -1
  96. package/dist/esm/locales/it/parsers/ITCasualTimeParser.js +37 -37
  97. package/dist/esm/locales/it/parsers/ITCasualTimeParser.js.map +1 -1
  98. package/dist/esm/locales/it/parsers/ITMonthNameLittleEndianParser.d.ts +1 -1
  99. package/dist/esm/locales/it/parsers/ITMonthNameLittleEndianParser.js +5 -5
  100. package/dist/esm/locales/it/parsers/ITMonthNameLittleEndianParser.js.map +1 -1
  101. package/dist/esm/locales/it/parsers/ITMonthNameMiddleEndianParser.d.ts +4 -2
  102. package/dist/esm/locales/it/parsers/ITMonthNameMiddleEndianParser.js +17 -5
  103. package/dist/esm/locales/it/parsers/ITMonthNameMiddleEndianParser.js.map +1 -1
  104. package/dist/esm/locales/it/parsers/ITMonthNameParser.d.ts +2 -2
  105. package/dist/esm/locales/it/parsers/ITMonthNameParser.js +4 -3
  106. package/dist/esm/locales/it/parsers/ITMonthNameParser.js.map +1 -1
  107. package/dist/esm/locales/it/parsers/ITRelativeDateFormatParser.js +21 -7
  108. package/dist/esm/locales/it/parsers/ITRelativeDateFormatParser.js.map +1 -1
  109. package/dist/esm/locales/it/parsers/ITSlashMonthFormatParser.d.ts +1 -1
  110. package/dist/esm/locales/it/parsers/ITSlashMonthFormatParser.js +1 -1
  111. package/dist/esm/locales/it/parsers/ITTimeExpressionParser.d.ts +3 -2
  112. package/dist/esm/locales/it/parsers/ITTimeExpressionParser.js +35 -27
  113. package/dist/esm/locales/it/parsers/ITTimeExpressionParser.js.map +1 -1
  114. package/dist/esm/locales/it/parsers/ITTimeUnitAgoFormatParser.d.ts +1 -1
  115. package/dist/esm/locales/it/parsers/ITTimeUnitAgoFormatParser.js +9 -7
  116. package/dist/esm/locales/it/parsers/ITTimeUnitAgoFormatParser.js.map +1 -1
  117. package/dist/esm/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.d.ts +3 -1
  118. package/dist/esm/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.js +18 -9
  119. package/dist/esm/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.js.map +1 -1
  120. package/dist/esm/locales/it/parsers/ITTimeUnitLaterFormatParser.d.ts +1 -1
  121. package/dist/esm/locales/it/parsers/ITTimeUnitLaterFormatParser.js +9 -6
  122. package/dist/esm/locales/it/parsers/ITTimeUnitLaterFormatParser.js.map +1 -1
  123. package/dist/esm/locales/it/parsers/ITTimeUnitWithinFormatParser.d.ts +3 -1
  124. package/dist/esm/locales/it/parsers/ITTimeUnitWithinFormatParser.js +22 -6
  125. package/dist/esm/locales/it/parsers/ITTimeUnitWithinFormatParser.js.map +1 -1
  126. package/dist/esm/locales/it/parsers/ITWeekdayParser.d.ts +1 -1
  127. package/dist/esm/locales/it/parsers/ITWeekdayParser.js +21 -12
  128. package/dist/esm/locales/it/parsers/ITWeekdayParser.js.map +1 -1
  129. package/dist/esm/locales/it/parsers/{ITCasualYearMonthDayParser.d.ts → ITYearMonthDayParser.d.ts} +3 -1
  130. package/dist/esm/locales/it/parsers/{ITCasualYearMonthDayParser.js → ITYearMonthDayParser.js} +20 -7
  131. package/dist/esm/locales/it/parsers/ITYearMonthDayParser.js.map +1 -0
  132. package/dist/esm/locales/it/refiners/ITExtractYearSuffixRefiner.d.ts +5 -0
  133. package/dist/esm/locales/it/refiners/ITExtractYearSuffixRefiner.js +31 -0
  134. package/dist/esm/locales/it/refiners/ITExtractYearSuffixRefiner.js.map +1 -0
  135. package/dist/esm/locales/it/refiners/ITMergeDateRangeRefiner.d.ts +1 -1
  136. package/dist/esm/locales/it/refiners/ITMergeDateRangeRefiner.js +2 -2
  137. package/dist/esm/locales/it/refiners/ITMergeDateRangeRefiner.js.map +1 -1
  138. package/dist/esm/locales/it/refiners/ITMergeDateTimeRefiner.d.ts +1 -1
  139. package/dist/esm/locales/it/refiners/ITMergeDateTimeRefiner.js +2 -2
  140. package/dist/esm/locales/it/refiners/ITMergeDateTimeRefiner.js.map +1 -1
  141. package/dist/esm/locales/it/refiners/ITMergeRelativeAfterDateRefiner.d.ts +6 -0
  142. package/dist/esm/locales/it/refiners/ITMergeRelativeAfterDateRefiner.js +27 -0
  143. package/dist/esm/locales/it/refiners/ITMergeRelativeAfterDateRefiner.js.map +1 -0
  144. package/dist/esm/locales/it/refiners/{ITMergeRelativeDateRefiner.d.ts → ITMergeRelativeFollowByDateRefiner.d.ts} +1 -1
  145. package/dist/esm/locales/it/refiners/{ITMergeRelativeDateRefiner.js → ITMergeRelativeFollowByDateRefiner.js} +7 -7
  146. package/dist/esm/locales/it/refiners/ITMergeRelativeFollowByDateRefiner.js.map +1 -0
  147. package/dist/esm/locales/it/refiners/ITUnlikelyFormatFilter.d.ts +6 -0
  148. package/dist/esm/locales/it/refiners/ITUnlikelyFormatFilter.js +23 -0
  149. package/dist/esm/locales/it/refiners/ITUnlikelyFormatFilter.js.map +1 -0
  150. package/dist/esm/results.js +14 -9
  151. package/dist/esm/results.js.map +1 -1
  152. package/package.json +5 -1
  153. package/src/locales/en/constants.ts +1 -1
  154. package/src/locales/en/parsers/ENMonthNameMiddleEndianParser.ts +1 -1
  155. package/src/locales/fr/constants.ts +13 -0
  156. package/src/locales/it/configuration.ts +85 -0
  157. package/src/locales/it/constants.ts +273 -123
  158. package/src/locales/it/index.ts +14 -73
  159. package/src/locales/it/parsers/ITCasualDateParser.ts +20 -12
  160. package/src/locales/it/parsers/ITCasualTimeParser.ts +39 -44
  161. package/src/locales/it/parsers/ITMonthNameLittleEndianParser.ts +6 -6
  162. package/src/locales/it/parsers/ITMonthNameMiddleEndianParser.ts +34 -17
  163. package/src/locales/it/parsers/ITMonthNameParser.ts +9 -8
  164. package/src/locales/it/parsers/ITRelativeDateFormatParser.ts +33 -12
  165. package/src/locales/it/parsers/ITSlashMonthFormatParser.ts +1 -1
  166. package/src/locales/it/parsers/ITTimeExpressionParser.ts +42 -28
  167. package/src/locales/it/parsers/ITTimeUnitAgoFormatParser.ts +9 -8
  168. package/src/locales/it/parsers/ITTimeUnitCasualRelativeFormatParser.ts +21 -11
  169. package/src/locales/it/parsers/ITTimeUnitLaterFormatParser.ts +12 -6
  170. package/src/locales/it/parsers/ITTimeUnitWithinFormatParser.ts +28 -8
  171. package/src/locales/it/parsers/ITWeekdayParser.ts +23 -13
  172. package/src/locales/it/parsers/{ITCasualYearMonthDayParser.ts → ITYearMonthDayParser.ts} +19 -8
  173. package/src/locales/it/refiners/ITExtractYearSuffixRefiner.ts +34 -0
  174. package/src/locales/it/refiners/ITMergeDateRangeRefiner.ts +5 -9
  175. package/src/locales/it/refiners/ITMergeDateTimeRefiner.ts +5 -5
  176. package/src/locales/it/refiners/ITMergeRelativeAfterDateRefiner.ts +46 -0
  177. package/src/locales/it/refiners/{ITMergeRelativeDateRefiner.ts → ITMergeRelativeFollowByDateRefiner.ts} +10 -10
  178. package/src/locales/it/refiners/ITUnlikelyFormatFilter.ts +31 -0
  179. package/src/results.ts +40 -9
  180. package/dist/cjs/locales/it/parsers/ITCasualYearMonthDayParser.js.map +0 -1
  181. package/dist/cjs/locales/it/refiners/ITMergeRelativeDateRefiner.js.map +0 -1
  182. package/dist/esm/locales/it/parsers/ITCasualYearMonthDayParser.js.map +0 -1
  183. package/dist/esm/locales/it/refiners/ITMergeRelativeDateRefiner.js.map +0 -1
  184. package/test/calculation_duration.test.ts +0 -165
  185. package/test/calculation_weekdays.test.ts +0 -133
  186. package/test/de/de_casual.test.ts +0 -336
  187. package/test/de/de_dash.test.ts +0 -32
  188. package/test/de/de_month_name_little_endian.test.ts +0 -273
  189. package/test/de/de_time_exp.test.ts +0 -223
  190. package/test/de/de_time_units_casual_relative.test.ts +0 -120
  191. package/test/de/de_time_units_within.test.ts +0 -119
  192. package/test/de/de_weekday.test.ts +0 -158
  193. package/test/de/de_year.test.ts +0 -147
  194. package/test/debugging.test.ts +0 -17
  195. package/test/en/en.test.ts +0 -191
  196. package/test/en/en_casual.test.ts +0 -425
  197. package/test/en/en_inter_std.test.ts +0 -118
  198. package/test/en/en_merging_relative_dates.test.ts +0 -50
  199. package/test/en/en_month.test.ts +0 -339
  200. package/test/en/en_month_name_little_endian.test.ts +0 -448
  201. package/test/en/en_month_name_middle_endian.test.ts +0 -386
  202. package/test/en/en_performance.test.ts +0 -26
  203. package/test/en/en_relative.test.ts +0 -393
  204. package/test/en/en_slash.test.ts +0 -284
  205. package/test/en/en_time_exp.test.ts +0 -535
  206. package/test/en/en_time_units_ago.test.ts +0 -357
  207. package/test/en/en_time_units_casual_relative.test.ts +0 -186
  208. package/test/en/en_time_units_later.test.ts +0 -361
  209. package/test/en/en_time_units_within.test.ts +0 -417
  210. package/test/en/en_timezone_exp.test.ts +0 -410
  211. package/test/en/en_weekday.test.ts +0 -573
  212. package/test/en/en_year.test.ts +0 -138
  213. package/test/en/en_year_month_day.test.ts +0 -101
  214. package/test/en/negative_cases.test.ts +0 -99
  215. package/test/es/es_casual.test.ts +0 -175
  216. package/test/es/es_month_name_little_endian.test.ts +0 -217
  217. package/test/es/es_slash.test.ts +0 -26
  218. package/test/es/es_time_exp.test.ts +0 -175
  219. package/test/es/es_time_units_within.test.ts +0 -119
  220. package/test/fi/fi_casual.test.ts +0 -99
  221. package/test/fi/fi_casual_time.test.ts +0 -56
  222. package/test/fi/fi_month_name_little_endian.test.ts +0 -50
  223. package/test/fi/fi_time_exp.test.ts +0 -39
  224. package/test/fi/fi_time_units_ago.test.ts +0 -93
  225. package/test/fi/fi_time_units_casual_relative.test.ts +0 -117
  226. package/test/fi/fi_time_units_within.test.ts +0 -74
  227. package/test/fi/fi_weekday.test.ts +0 -90
  228. package/test/fr/fr_casual.test.ts +0 -314
  229. package/test/fr/fr_little_endian.test.ts +0 -320
  230. package/test/fr/fr_slash.test.ts +0 -49
  231. package/test/fr/fr_time_exp.test.ts +0 -588
  232. package/test/fr/fr_time_units_ago.test.ts +0 -103
  233. package/test/fr/fr_time_units_casual_relative.test.ts +0 -114
  234. package/test/fr/fr_time_units_within.test.ts +0 -129
  235. package/test/fr/fr_weekday.test.ts +0 -130
  236. package/test/it/it_casual.test.ts +0 -81
  237. package/test/it/it_month_name_little_endian.test.ts +0 -28
  238. package/test/it/it_month_name_middle_endian.test.ts +0 -39
  239. package/test/it/it_time_exp.test.ts +0 -84
  240. package/test/it/it_weekday.test.ts +0 -37
  241. package/test/it/it_year_month_day.test.ts +0 -41
  242. package/test/ja/ja_casual.test.ts +0 -73
  243. package/test/ja/ja_slash_date_format.test.ts +0 -60
  244. package/test/ja/ja_standard.test.ts +0 -235
  245. package/test/ja/ja_time_exp.test.ts +0 -305
  246. package/test/ja/ja_weekday.test.ts +0 -183
  247. package/test/nl/nl_casual.test.ts +0 -408
  248. package/test/nl/nl_month.test.ts +0 -205
  249. package/test/nl/nl_month_name_little_endian.test.ts +0 -358
  250. package/test/nl/nl_relative.test.ts +0 -242
  251. package/test/nl/nl_slash.test.ts +0 -206
  252. package/test/nl/nl_time_exp.test.ts +0 -79
  253. package/test/nl/nl_time_units_ago.test.ts +0 -243
  254. package/test/nl/nl_time_units_casual_relative.test.ts +0 -130
  255. package/test/nl/nl_time_units_later.test.ts +0 -250
  256. package/test/nl/nl_time_units_within.test.ts +0 -225
  257. package/test/nl/nl_weekday.test.ts +0 -216
  258. package/test/pt/pt_casual.test.ts +0 -175
  259. package/test/pt/pt_month_name_little_endian.test.ts +0 -217
  260. package/test/pt/pt_slash.test.ts +0 -26
  261. package/test/pt/pt_time_exp.test.ts +0 -175
  262. package/test/result.test.ts +0 -283
  263. package/test/ru/ru_casual.test.ts +0 -159
  264. package/test/ru/ru_month.test.ts +0 -70
  265. package/test/ru/ru_month_name_little_endian.test.ts +0 -145
  266. package/test/ru/ru_relative.test.ts +0 -107
  267. package/test/ru/ru_time_exp.test.ts +0 -111
  268. package/test/ru/ru_time_units_ago.test.ts +0 -48
  269. package/test/ru/ru_time_units_casual_relative.test.ts +0 -190
  270. package/test/ru/ru_time_units_within.test.ts +0 -16
  271. package/test/ru/ru_weekday.test.ts +0 -52
  272. package/test/sv/sv_casual.test.ts +0 -87
  273. package/test/sv/sv_month_name_little_endian.test.ts +0 -48
  274. package/test/sv/sv_time_units_casual_relative.test.ts +0 -143
  275. package/test/sv/sv_weekday.test.ts +0 -68
  276. package/test/system.test.ts +0 -247
  277. package/test/system_timezone.test.ts +0 -284
  278. package/test/test_util.ts +0 -135
  279. package/test/uk/uk_casual.test.ts +0 -153
  280. package/test/uk/uk_month.test.ts +0 -70
  281. package/test/uk/uk_month_name_little_endian.test.ts +0 -148
  282. package/test/uk/uk_relative.test.ts +0 -107
  283. package/test/uk/uk_time_exp.test.ts +0 -111
  284. package/test/uk/uk_time_units_ago.test.ts +0 -48
  285. package/test/uk/uk_time_units_casual_relative.test.ts +0 -142
  286. package/test/uk/uk_time_units_within.test.ts +0 -23
  287. package/test/uk/uk_weekday.test.ts +0 -52
  288. package/test/vi/vi_casual.test.ts +0 -84
  289. package/test/vi/vi_casual_time.test.ts +0 -77
  290. package/test/vi/vi_date_range.test.ts +0 -61
  291. package/test/vi/vi_forward_date.test.ts +0 -45
  292. package/test/vi/vi_month_year.test.ts +0 -40
  293. package/test/vi/vi_negative_cases.test.ts +0 -60
  294. package/test/vi/vi_slash.test.ts +0 -36
  295. package/test/vi/vi_standard.test.ts +0 -86
  296. package/test/vi/vi_strict.test.ts +0 -67
  297. package/test/vi/vi_time_exp.test.ts +0 -99
  298. package/test/vi/vi_time_units_ago.test.ts +0 -56
  299. package/test/vi/vi_time_units_casual_relative.test.ts +0 -56
  300. package/test/vi/vi_time_units_later.test.ts +0 -43
  301. package/test/vi/vi_time_units_within.test.ts +0 -24
  302. package/test/vi/vi_weekday.test.ts +0 -77
  303. package/test/vi/vi_year.test.ts +0 -42
  304. package/test/zh/hans/zh_hans_ago.test.ts +0 -58
  305. package/test/zh/hans/zh_hans_casual.test.ts +0 -242
  306. package/test/zh/hans/zh_hans_date.test.ts +0 -116
  307. package/test/zh/hans/zh_hans_deadline.test.ts +0 -175
  308. package/test/zh/hans/zh_hans_time_exp.test.ts +0 -508
  309. package/test/zh/hans/zh_hans_weekday.test.ts +0 -219
  310. package/test/zh/hant/zh_hant_ago.test.ts +0 -58
  311. package/test/zh/hant/zh_hant_casual.test.ts +0 -260
  312. package/test/zh/hant/zh_hant_date.test.ts +0 -116
  313. package/test/zh/hant/zh_hant_deadline.test.ts +0 -136
  314. package/test/zh/hant/zh_hant_time_exp.test.ts +0 -226
  315. package/test/zh/hant/zh_hant_weekday.test.ts +0 -175
  316. package/test/zh/zh.test.ts +0 -36
  317. package/tsconfig.build.esm.json +0 -8
  318. package/tsconfig.build.json +0 -10
  319. package/tsconfig.json +0 -29
@@ -22,12 +22,18 @@ export const MONTH_DICTIONARY: { [word: string]: number } = {
22
22
  "janvier": 1,
23
23
  "jan": 1,
24
24
  "jan.": 1,
25
+ "janv": 1,
26
+ "janv.": 1,
25
27
  "février": 2,
26
28
  "fév": 2,
27
29
  "fév.": 2,
30
+ "févr": 2,
31
+ "févr.": 2,
28
32
  "fevrier": 2,
29
33
  "fev": 2,
30
34
  "fev.": 2,
35
+ "fevr": 2,
36
+ "fevr.": 2,
31
37
  "mars": 3,
32
38
  "mar": 3,
33
39
  "mar.": 3,
@@ -36,13 +42,18 @@ export const MONTH_DICTIONARY: { [word: string]: number } = {
36
42
  "avr.": 4,
37
43
  "mai": 5,
38
44
  "juin": 6,
45
+ "juin.": 6,
39
46
  "jun": 6,
47
+ "jun.": 6,
40
48
  "juillet": 7,
41
49
  "juil": 7,
50
+ "juil.": 7,
42
51
  "jul": 7,
43
52
  "jul.": 7,
44
53
  "août": 8,
54
+ "août.": 8,
45
55
  "aout": 8,
56
+ "aout.": 8,
46
57
  "septembre": 9,
47
58
  "sep": 9,
48
59
  "sep.": 9,
@@ -58,6 +69,8 @@ export const MONTH_DICTIONARY: { [word: string]: number } = {
58
69
  "decembre": 12,
59
70
  "dec": 12,
60
71
  "dec.": 12,
72
+ "déc": 12,
73
+ "déc.": 12,
61
74
  };
62
75
 
63
76
  export const INTEGER_WORD_DICTIONARY: { [word: string]: number } = {
@@ -0,0 +1,85 @@
1
+ import { Configuration } from "../../chrono";
2
+
3
+ import ITTimeUnitWithinFormatParser from "./parsers/ITTimeUnitWithinFormatParser";
4
+ import ITMonthNameLittleEndianParser from "./parsers/ITMonthNameLittleEndianParser";
5
+ import ITMonthNameMiddleEndianParser from "./parsers/ITMonthNameMiddleEndianParser";
6
+ import ITMonthNameParser from "./parsers/ITMonthNameParser";
7
+ import ITYearMonthDayParser from "./parsers/ITYearMonthDayParser";
8
+ import ITSlashMonthFormatParser from "./parsers/ITSlashMonthFormatParser";
9
+ import ITTimeExpressionParser from "./parsers/ITTimeExpressionParser";
10
+ import ITTimeUnitAgoFormatParser from "./parsers/ITTimeUnitAgoFormatParser";
11
+ import ITTimeUnitLaterFormatParser from "./parsers/ITTimeUnitLaterFormatParser";
12
+ import ITMergeDateRangeRefiner from "./refiners/ITMergeDateRangeRefiner";
13
+ import ITMergeDateTimeRefiner from "./refiners/ITMergeDateTimeRefiner";
14
+
15
+ import { includeCommonConfiguration } from "../../configurations";
16
+ import ITCasualDateParser from "./parsers/ITCasualDateParser";
17
+ import ITCasualTimeParser from "./parsers/ITCasualTimeParser";
18
+ import ITWeekdayParser from "./parsers/ITWeekdayParser";
19
+ import ITRelativeDateFormatParser from "./parsers/ITRelativeDateFormatParser";
20
+
21
+ import SlashDateFormatParser from "../../common/parsers/SlashDateFormatParser";
22
+ import ITTimeUnitCasualRelativeFormatParser from "./parsers/ITTimeUnitCasualRelativeFormatParser";
23
+ import ITMergeRelativeAfterDateRefiner from "./refiners/ITMergeRelativeAfterDateRefiner";
24
+ import ITMergeRelativeFollowByDateRefiner from "./refiners/ITMergeRelativeFollowByDateRefiner";
25
+ import OverlapRemovalRefiner from "../../common/refiners/OverlapRemovalRefiner";
26
+ import ITExtractYearSuffixRefiner from "./refiners/ITExtractYearSuffixRefiner";
27
+ import ITUnlikelyFormatFilter from "./refiners/ITUnlikelyFormatFilter";
28
+
29
+ export default class ITDefaultConfiguration {
30
+ /**
31
+ * Create a default *casual* {@link Configuration} for Italian chrono.
32
+ * It calls {@link createConfiguration} and includes additional parsers.
33
+ */
34
+ createCasualConfiguration(): Configuration {
35
+ const option = this.createConfiguration(false);
36
+ option.parsers.push(new ITCasualDateParser());
37
+ option.parsers.push(new ITCasualTimeParser());
38
+ option.parsers.push(new ITMonthNameParser());
39
+ option.parsers.push(new ITRelativeDateFormatParser());
40
+ option.parsers.push(new ITTimeUnitCasualRelativeFormatParser());
41
+ option.refiners.push(new ITUnlikelyFormatFilter());
42
+ return option;
43
+ }
44
+
45
+ /**
46
+ * Create a default {@link Configuration} for Italian chrono
47
+ *
48
+ * @param strictMode If the timeunit mentioning should be strict, not casual
49
+ */
50
+ createConfiguration(strictMode = true): Configuration {
51
+ const options = includeCommonConfiguration(
52
+ {
53
+ parsers: [
54
+ new SlashDateFormatParser(true), // Italian uses day/month/year format (littleEndian)
55
+ new ITTimeUnitWithinFormatParser(strictMode),
56
+ new ITMonthNameLittleEndianParser(),
57
+ new ITMonthNameMiddleEndianParser(/*shouldSkipYearLikeDate=*/ true),
58
+ new ITWeekdayParser(),
59
+ new ITSlashMonthFormatParser(),
60
+ new ITTimeExpressionParser(strictMode),
61
+ new ITTimeUnitAgoFormatParser(strictMode),
62
+ new ITTimeUnitLaterFormatParser(strictMode),
63
+ ],
64
+ refiners: [new ITMergeDateTimeRefiner()],
65
+ },
66
+ strictMode
67
+ );
68
+ options.parsers.unshift(new ITYearMonthDayParser(/*strictMonthDateOrder=*/ strictMode));
69
+
70
+ // These relative-dates consideration should be done before other common refiners.
71
+ options.refiners.unshift(new ITMergeRelativeFollowByDateRefiner());
72
+ options.refiners.unshift(new ITMergeRelativeAfterDateRefiner());
73
+ options.refiners.unshift(new OverlapRemovalRefiner());
74
+
75
+ // Re-apply the date time refiner again after the timezone refinement and exclusion in common refiners.
76
+ options.refiners.push(new ITMergeDateTimeRefiner());
77
+
78
+ // Extract year after merging date and time
79
+ options.refiners.push(new ITExtractYearSuffixRefiner());
80
+
81
+ // Keep the date range refiner at the end (after all other refinements).
82
+ options.refiners.push(new ITMergeDateRangeRefiner());
83
+ return options;
84
+ }
85
+ }
@@ -1,162 +1,293 @@
1
1
  import { matchAnyPattern, repeatedTimeunitPattern } from "../../utils/pattern";
2
2
  import { findMostLikelyADYear } from "../../calculation/years";
3
3
  import { Duration } from "../../calculation/duration";
4
- import { Timeunit } from "../../types";
5
-
6
- export const WEEKDAY_DICTIONARY: { [word: string]: number } = {
7
- "domenica": 0,
8
- "dom": 0,
9
- "lunedì": 1,
10
- "lun": 1,
11
- "martedì": 2,
12
- "mar": 2,
13
- "mercoledì": 3,
14
- "merc": 3,
15
- "giovedì": 4,
16
- "giov": 4,
17
- "venerdì": 5,
18
- "ven": 5,
19
- "sabato": 6,
20
- "sab": 6,
4
+ import { Timeunit, Weekday } from "../../types";
5
+
6
+ export const WEEKDAY_DICTIONARY: { [word: string]: Weekday } = {
7
+ domenica: 0,
8
+ dom: 0,
9
+ "dom.": 0,
10
+ lunedì: 1,
11
+ lunedi: 1,
12
+ lun: 1,
13
+ "lun.": 1,
14
+ martedì: 2,
15
+ martedi: 2,
16
+ mar: 2,
17
+ "mar.": 2,
18
+ mercoledì: 3,
19
+ mercoledi: 3,
20
+ mer: 3,
21
+ "mer.": 3,
22
+ giovedì: 4,
23
+ giovedi: 4,
24
+ gio: 4,
25
+ "gio.": 4,
26
+ venerdì: 5,
27
+ venerdi: 5,
28
+ ven: 5,
29
+ "ven.": 5,
30
+ sabato: 6,
31
+ sab: 6,
32
+ "sab.": 6,
21
33
  };
22
34
 
23
- export const FULL_MONTH_NAME_DICTIONARY: { [word: string]: number } = {};
35
+ export const FULL_MONTH_NAME_DICTIONARY: { [word: string]: number } = {
36
+ gennaio: 1,
37
+ febbraio: 2,
38
+ marzo: 3,
39
+ aprile: 4,
40
+ maggio: 5,
41
+ giugno: 6,
42
+ luglio: 7,
43
+ agosto: 8,
44
+ settembre: 9,
45
+ ottobre: 10,
46
+ novembre: 11,
47
+ dicembre: 12,
48
+ };
24
49
 
25
50
  export const MONTH_DICTIONARY: { [word: string]: number } = {
26
51
  ...FULL_MONTH_NAME_DICTIONARY,
27
- "gennaio": 1,
28
- "gen": 1,
52
+ gen: 1,
29
53
  "gen.": 1,
30
- "febbraio": 2,
31
- "feb": 2,
54
+ feb: 2,
32
55
  "feb.": 2,
33
- "febraio": 2,
34
- "febb": 2,
35
- "febb.": 2,
36
- "marzo": 3,
37
- "mar": 3,
56
+ mar: 3,
38
57
  "mar.": 3,
39
- "aprile": 4,
40
- "apr": 4,
58
+ apr: 4,
41
59
  "apr.": 4,
42
- "maggio": 5,
43
- "mag": 5,
44
- "giugno": 6,
45
- "giu": 6,
46
- "luglio": 7,
47
- "lug": 7,
48
- "lugl": 7,
60
+ mag: 5,
61
+ "mag.": 5,
62
+ giu: 6,
63
+ "giu.": 6,
64
+ lug: 7,
49
65
  "lug.": 7,
50
- "agosto": 8,
51
- "ago": 8,
52
- "settembre": 9,
53
- "set": 9,
66
+ ago: 8,
67
+ "ago.": 8,
68
+ set: 9,
54
69
  "set.": 9,
55
- "sett": 9,
70
+ sett: 9,
56
71
  "sett.": 9,
57
- "ottobre": 10,
58
- "ott": 10,
72
+ ott: 10,
59
73
  "ott.": 10,
60
- "novembre": 11,
61
- "nov": 11,
74
+ nov: 11,
62
75
  "nov.": 11,
63
- "dicembre": 12,
64
- "dic": 12,
65
- "dice": 12,
76
+ dic: 12,
66
77
  "dic.": 12,
67
78
  };
68
79
 
69
80
  export const INTEGER_WORD_DICTIONARY: { [word: string]: number } = {
70
- "uno": 1,
71
- "due": 2,
72
- "tre": 3,
73
- "quattro": 4,
74
- "cinque": 5,
75
- "sei": 6,
76
- "sette": 7,
77
- "otto": 8,
78
- "nove": 9,
79
- "dieci": 10,
80
- "undici": 11,
81
- "dodici": 12,
81
+ uno: 1,
82
+ una: 1,
83
+ un: 1,
84
+ due: 2,
85
+ tre: 3,
86
+ quattro: 4,
87
+ cinque: 5,
88
+ sei: 6,
89
+ sette: 7,
90
+ otto: 8,
91
+ nove: 9,
92
+ dieci: 10,
93
+ undici: 11,
94
+ dodici: 12,
82
95
  };
83
96
 
84
97
  export const ORDINAL_WORD_DICTIONARY: { [word: string]: number } = {
85
- "primo": 1,
86
- "secondo": 2,
87
- "terzo": 3,
88
- "quarto": 4,
89
- "quinto": 5,
90
- "sesto": 6,
91
- "settimo": 7,
92
- "ottavo": 8,
93
- "nono": 9,
94
- "decimo": 10,
95
- "undicesimo": 11,
96
- "dodicesimo": 12,
97
- "tredicesimo": 13,
98
- "quattordicesimo": 14,
99
- "quindicesimo": 15,
100
- "sedicesimo": 16,
101
- "diciassettesimo": 17,
102
- "diciottesimo": 18,
103
- "diciannovesimo": 19,
104
- "ventesimo": 20,
105
- "ventunesimo": 21,
106
- "ventiduesimo": 22,
107
- "ventitreesimo": 23,
108
- "ventiquattresimo": 24,
109
- "venticinquesimo": 25,
110
- "ventiseiesimo": 26,
111
- "ventisettesimo": 27,
112
- "ventottesimo": 28,
113
- "ventinovesimo": 29,
114
- "trentesimo": 30,
115
- "trentunesimo": 31,
98
+ primo: 1,
99
+ prima: 1,
100
+ "1°": 1,
101
+ "1ª": 1,
102
+ secondo: 2,
103
+ seconda: 2,
104
+ "2°": 2,
105
+ "2ª": 2,
106
+ terzo: 3,
107
+ terza: 3,
108
+ "3°": 3,
109
+ "3ª": 3,
110
+ quarto: 4,
111
+ quarta: 4,
112
+ "4°": 4,
113
+ "4ª": 4,
114
+ quinto: 5,
115
+ quinta: 5,
116
+ "5°": 5,
117
+ "5ª": 5,
118
+ sesto: 6,
119
+ sesta: 6,
120
+ "6°": 6,
121
+ "6ª": 6,
122
+ settimo: 7,
123
+ settima: 7,
124
+ "7°": 7,
125
+ "7ª": 7,
126
+ ottavo: 8,
127
+ ottava: 8,
128
+ "8°": 8,
129
+ "8ª": 8,
130
+ nono: 9,
131
+ nona: 9,
132
+ "9°": 9,
133
+ "9ª": 9,
134
+ decimo: 10,
135
+ decima: 10,
136
+ "10°": 10,
137
+ "10ª": 10,
138
+ undicesimo: 11,
139
+ undicesima: 11,
140
+ "11°": 11,
141
+ "11ª": 11,
142
+ dodicesimo: 12,
143
+ dodicesima: 12,
144
+ "12°": 12,
145
+ "12ª": 12,
146
+ tredicesimo: 13,
147
+ tredicesima: 13,
148
+ "13°": 13,
149
+ "13ª": 13,
150
+ quattordicesimo: 14,
151
+ quattordicesima: 14,
152
+ "14°": 14,
153
+ "14ª": 14,
154
+ quindicesimo: 15,
155
+ quindicesima: 15,
156
+ "15°": 15,
157
+ "15ª": 15,
158
+ sedicesimo: 16,
159
+ sedicesima: 16,
160
+ "16°": 16,
161
+ "16ª": 16,
162
+ diciassettesimo: 17,
163
+ diciassettesima: 17,
164
+ "17°": 17,
165
+ "17ª": 17,
166
+ diciottesimo: 18,
167
+ diciottesima: 18,
168
+ "18°": 18,
169
+ "18ª": 18,
170
+ diciannovesimo: 19,
171
+ diciannovesima: 19,
172
+ "19°": 19,
173
+ "19ª": 19,
174
+ ventesimo: 20,
175
+ ventesima: 20,
176
+ "20°": 20,
177
+ "20ª": 20,
178
+ ventunesimo: 21,
179
+ ventunesima: 21,
180
+ "21°": 21,
181
+ "21ª": 21,
182
+ ventiduesimo: 22,
183
+ ventiduesima: 22,
184
+ "22°": 22,
185
+ "22ª": 22,
186
+ ventitreesimo: 23,
187
+ ventitreesima: 23,
188
+ "23°": 23,
189
+ "23ª": 23,
190
+ ventiquattresimo: 24,
191
+ ventiquattresima: 24,
192
+ "24°": 24,
193
+ "24ª": 24,
194
+ venticinquesimo: 25,
195
+ venticinquesima: 25,
196
+ "25°": 25,
197
+ "25ª": 25,
198
+ ventiseiesimo: 26,
199
+ ventiseiesima: 26,
200
+ "26°": 26,
201
+ "26ª": 26,
202
+ ventisettesimo: 27,
203
+ ventisettesima: 27,
204
+ "27°": 27,
205
+ "27ª": 27,
206
+ ventottesimo: 28,
207
+ ventottesima: 28,
208
+ "28°": 28,
209
+ "28ª": 28,
210
+ ventinovesimo: 29,
211
+ ventinovesima: 29,
212
+ "29°": 29,
213
+ "29ª": 29,
214
+ trentesimo: 30,
215
+ trentesima: 30,
216
+ "30°": 30,
217
+ "30ª": 30,
218
+ trentunesimo: 31,
219
+ trentunesima: 31,
220
+ "31°": 31,
221
+ "31ª": 31,
222
+ };
223
+
224
+ export const TIME_UNIT_DICTIONARY_NO_ABBR: { [word: string]: Timeunit } = {
225
+ secondo: "second",
226
+ secondi: "second",
227
+ minuto: "minute",
228
+ minuti: "minute",
229
+ ora: "hour",
230
+ ore: "hour",
231
+ giorno: "day",
232
+ giorni: "day",
233
+ settimana: "week",
234
+ settimane: "week",
235
+ mese: "month",
236
+ mesi: "month",
237
+ trimestre: "quarter",
238
+ trimestri: "quarter",
239
+ anno: "year",
240
+ anni: "year",
116
241
  };
117
242
 
118
243
  export const TIME_UNIT_DICTIONARY: { [word: string]: Timeunit } = {
119
- "sec": "second",
120
- "secondo": "second",
121
- "secondi": "second",
122
- "min": "minute",
123
- "mins": "minute",
124
- "minuti": "minute",
125
- "h": "hour",
126
- "hr": "hour",
127
- "o": "hour",
128
- "ora": "hour",
129
- "ore": "hour",
130
- "giorno": "day",
131
- "giorni": "day",
132
- "settimana": "week",
133
- "settimane": "week",
134
- "mese": "month",
135
- "trimestre": "quarter",
136
- "trimestri": "quarter",
137
- "anni": "year",
138
- "anno": "year",
244
+ s: "second",
245
+ sec: "second",
246
+ secondo: "second",
247
+ secondi: "second",
248
+ m: "minute",
249
+ min: "minute",
250
+ minuto: "minute",
251
+ minuti: "minute",
252
+ h: "hour",
253
+ ora: "hour",
254
+ ore: "hour",
255
+ g: "day",
256
+ gg: "day",
257
+ giorno: "day",
258
+ giorni: "day",
259
+ sett: "week",
260
+ settimana: "week",
261
+ settimane: "week",
262
+ mese: "month",
263
+ mesi: "month",
264
+ trim: "quarter",
265
+ trimestre: "quarter",
266
+ trimestri: "quarter",
267
+ anno: "year",
268
+ anni: "year",
269
+ ...TIME_UNIT_DICTIONARY_NO_ABBR,
139
270
  };
140
271
 
141
272
  //-----------------------------
142
273
 
143
274
  export const NUMBER_PATTERN = `(?:${matchAnyPattern(
144
275
  INTEGER_WORD_DICTIONARY
145
- )}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}un?)?|un?\\b(?:\\s{0,2}qualcuno)?|qualcuno|molti|a?\\s{0,2}alcuni\\s{0,2}(?:of)?)`;
276
+ )}|[0-9]+|[0-9]+\\.[0-9]+|mezz[oa]?(?:\\s{0,2})?|un(?:'|\\s{0,2})?|qualche|alcuni|paio\\s{0,2}(?:di)?)`;
146
277
 
147
278
  export function parseNumberPattern(match: string): number {
148
279
  const num = match.toLowerCase();
149
280
  if (INTEGER_WORD_DICTIONARY[num] !== undefined) {
150
281
  return INTEGER_WORD_DICTIONARY[num];
151
- } else if (num === "un" || num === "una") {
282
+ } else if (num === "un" || num === "un'" || num === "una" || num === "uno") {
152
283
  return 1;
153
- } else if (num.match(/alcuni/)) {
284
+ } else if (num.match(/qualche/)) {
154
285
  return 3;
155
- } else if (num.match(/metá/)) {
286
+ } else if (num.match(/mezz/)) {
156
287
  return 0.5;
157
288
  } else if (num.match(/paio/)) {
158
289
  return 2;
159
- } else if (num.match(/molti/)) {
290
+ } else if (num.match(/alcuni/)) {
160
291
  return 7;
161
292
  }
162
293
 
@@ -165,22 +296,20 @@ export function parseNumberPattern(match: string): number {
165
296
 
166
297
  //-----------------------------
167
298
 
168
- export const ORDINAL_NUMBER_PATTERN = `(?:${matchAnyPattern(
169
- ORDINAL_WORD_DICTIONARY
170
- )}|[0-9]{1,2}(?:mo|ndo|rzo|simo|esimo)?)`;
299
+ export const ORDINAL_NUMBER_PATTERN = `(?:${matchAnyPattern(ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:°|ª|º)?)`;
171
300
  export function parseOrdinalNumberPattern(match: string): number {
172
301
  let num = match.toLowerCase();
173
302
  if (ORDINAL_WORD_DICTIONARY[num] !== undefined) {
174
303
  return ORDINAL_WORD_DICTIONARY[num];
175
304
  }
176
305
 
177
- num = num.replace(/(?:imo|ndo|rzo|rto|nto|sto|tavo|nono|cimo|timo|esimo)$/i, "");
306
+ num = num.replace(/(?:°|ª|º)$/i, "");
178
307
  return parseInt(num);
179
308
  }
180
309
 
181
310
  //-----------------------------
182
311
 
183
- export const YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])`;
312
+ export const YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])`;
184
313
  export function parseYear(match: string): number {
185
314
  if (/BE/i.test(match)) {
186
315
  // Buddhist Era
@@ -209,9 +338,24 @@ export function parseYear(match: string): number {
209
338
  const SINGLE_TIME_UNIT_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(TIME_UNIT_DICTIONARY)})`;
210
339
  const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
211
340
 
212
- export const TIME_UNITS_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN);
341
+ const SINGLE_TIME_UNIT_NO_ABBR_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(
342
+ TIME_UNIT_DICTIONARY_NO_ABBR
343
+ )})`;
344
+
345
+ const TIME_UNIT_CONNECTOR_PATTERN = `\\s{0,5},?(?:\\s*e)?\\s{0,5}`;
346
+
347
+ export const TIME_UNITS_PATTERN = repeatedTimeunitPattern(
348
+ `(?:(?:circa|approssimativamente)\\s{0,3})?`,
349
+ SINGLE_TIME_UNIT_PATTERN,
350
+ TIME_UNIT_CONNECTOR_PATTERN
351
+ );
352
+ export const TIME_UNITS_NO_ABBR_PATTERN = repeatedTimeunitPattern(
353
+ `(?:(?:circa|approssimativamente)\\s{0,3})?`,
354
+ SINGLE_TIME_UNIT_NO_ABBR_PATTERN,
355
+ TIME_UNIT_CONNECTOR_PATTERN
356
+ );
213
357
 
214
- export function parseDuration(timeunitText): Duration {
358
+ export function parseDuration(timeunitText): null | Duration {
215
359
  const fragments = {};
216
360
  let remainingText = timeunitText;
217
361
  let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
@@ -220,10 +364,16 @@ export function parseDuration(timeunitText): Duration {
220
364
  remainingText = remainingText.substring(match[0].length).trim();
221
365
  match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
222
366
  }
367
+ if (Object.keys(fragments).length == 0) {
368
+ return null;
369
+ }
223
370
  return fragments as Duration;
224
371
  }
225
372
 
226
373
  function collectDateTimeFragment(fragments, match) {
374
+ if (match[0].match(/^[a-zA-Z]+$/)) {
375
+ return;
376
+ }
227
377
  const num = parseNumberPattern(match[1]);
228
378
  const unit = TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
229
379
  fragments[unit] = num;