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
@@ -4,96 +4,37 @@
4
4
  * @module
5
5
  */
6
6
 
7
- import ENTimeUnitWithinFormatParser from "./parsers/ITTimeUnitWithinFormatParser";
8
- import ENMonthNameLittleEndianParser from "./parsers/ITMonthNameLittleEndianParser";
9
- import ENMonthNameMiddleEndianParser from "./parsers/ITMonthNameMiddleEndianParser";
10
- import ENMonthNameParser from "./parsers/ITMonthNameParser";
11
- import ENCasualYearMonthDayParser from "./parsers/ITCasualYearMonthDayParser";
12
- import ENSlashMonthFormatParser from "./parsers/ITSlashMonthFormatParser";
13
- import ENTimeExpressionParser from "./parsers/ITTimeExpressionParser";
14
- import ENTimeUnitAgoFormatParser from "./parsers/ITTimeUnitAgoFormatParser";
15
- import ENTimeUnitLaterFormatParser from "./parsers/ITTimeUnitLaterFormatParser";
16
- import ENMergeDateRangeRefiner from "./refiners/ITMergeDateRangeRefiner";
17
- import ENMergeDateTimeRefiner from "./refiners/ITMergeDateTimeRefiner";
7
+ import { Chrono, Parser, Refiner } from "../../chrono";
8
+ import { ParsingResult, ParsingComponents, ReferenceWithTimezone } from "../../results";
9
+ import { Component, ParsedResult, ParsingOption, ParsingReference, Meridiem, Weekday } from "../../types";
18
10
 
19
- import { includeCommonConfiguration } from "../../configurations";
20
- import ENCasualDateParser from "./parsers/ITCasualDateParser";
21
- import ENCasualTimeParser from "./parsers/ITCasualTimeParser";
22
- import ENWeekdayParser from "./parsers/ITWeekdayParser";
23
- import ITRelativeDateFormatParser from "./parsers/ITRelativeDateFormatParser";
11
+ import ITDefaultConfiguration from "./configuration";
24
12
 
25
- import { ParsedResult, ParsingOption } from "../../index";
26
- import { Chrono, Configuration } from "../../chrono";
27
- import SlashDateFormatParser from "../../common/parsers/SlashDateFormatParser";
28
- import ENTimeUnitCasualRelativeFormatParser from "./parsers/ITTimeUnitCasualRelativeFormatParser";
29
- import ENMergeRelativeDateRefiner from "./refiners/ITMergeRelativeDateRefiner";
13
+ export { Chrono, Parser, Refiner, ParsingResult, ParsingComponents, ReferenceWithTimezone };
14
+ export { Component, ParsedResult, ParsingOption, ParsingReference, Meridiem, Weekday };
15
+
16
+ export const configuration = new ITDefaultConfiguration();
30
17
 
31
18
  /**
32
19
  * Chrono object configured for parsing *casual* Italian
33
20
  */
34
- export const casual = new Chrono(createCasualConfiguration(false));
21
+ export const casual = new Chrono(configuration.createCasualConfiguration());
35
22
 
36
23
  /**
37
24
  * Chrono object configured for parsing *strict* Italian
38
25
  */
39
- export const strict = new Chrono(createConfiguration(true, false));
40
-
41
- /**
42
- * Chrono object configured for parsing Italian
43
- */
44
- export const GB = new Chrono(createConfiguration(false, true));
26
+ export const strict = new Chrono(configuration.createConfiguration(true));
45
27
 
46
28
  /**
47
- * A shortcut for en.casual.parse()
29
+ * A shortcut for it.casual.parse()
48
30
  */
49
- export function parse(text: string, ref?: Date, option?: ParsingOption): ParsedResult[] {
31
+ export function parse(text: string, ref?: ParsingReference | Date, option?: ParsingOption): ParsedResult[] {
50
32
  return casual.parse(text, ref, option);
51
33
  }
52
34
 
53
35
  /**
54
- * A shortcut for en.casual.parseDate()
36
+ * A shortcut for it.casual.parseDate()
55
37
  */
56
- export function parseDate(text: string, ref?: Date, option?: ParsingOption): Date {
38
+ export function parseDate(text: string, ref?: ParsingReference | Date, option?: ParsingOption): Date {
57
39
  return casual.parseDate(text, ref, option);
58
40
  }
59
-
60
- /**
61
- * Create a default *casual* {@Link Configuration} for Italian chrono.
62
- * It calls {@Link createConfiguration} and includes additional parsers.
63
- */
64
- export function createCasualConfiguration(littleEndian = false): Configuration {
65
- const option = createConfiguration(false, littleEndian);
66
- option.parsers.unshift(new ENCasualDateParser());
67
- option.parsers.unshift(new ENCasualTimeParser());
68
- option.parsers.unshift(new ENMonthNameParser());
69
- option.parsers.unshift(new ITRelativeDateFormatParser());
70
- option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser());
71
- return option;
72
- }
73
-
74
- /**
75
- * Create a default {@Link Configuration} for Italian chrono
76
- *
77
- * @param strictMode If the timeunit mentioning should be strict, not casual
78
- * @param littleEndian If format should be date-first/littleEndian (e.g. en_UK), not month-first/middleEndian (e.g. en_US)
79
- */
80
- export function createConfiguration(strictMode = true, littleEndian = false): Configuration {
81
- return includeCommonConfiguration(
82
- {
83
- parsers: [
84
- new SlashDateFormatParser(littleEndian),
85
- new ENTimeUnitWithinFormatParser(),
86
- new ENMonthNameLittleEndianParser(),
87
- new ENMonthNameMiddleEndianParser(),
88
- new ENWeekdayParser(),
89
- new ENCasualYearMonthDayParser(),
90
- new ENSlashMonthFormatParser(),
91
- new ENTimeExpressionParser(strictMode),
92
- new ENTimeUnitAgoFormatParser(strictMode),
93
- new ENTimeUnitLaterFormatParser(strictMode),
94
- ],
95
- refiners: [new ENMergeRelativeDateRefiner(), new ENMergeDateTimeRefiner(), new ENMergeDateRangeRefiner()],
96
- },
97
- strictMode
98
- );
99
- }
@@ -4,7 +4,7 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
4
4
  import { assignSimilarDate } from "../../../utils/dates";
5
5
  import * as references from "../../../common/casualReferences";
6
6
 
7
- const PATTERN = /(ora|oggi|stasera|questa sera|domani|dmn|ieri\s*sera)(?=\W|$)/i;
7
+ const PATTERN = /(adesso|ora|oggi|stasera|stanotte|domani|dopodomani|ieri|ieri\s*sera|ieri\s*notte)(?=\W|$)/i;
8
8
 
9
9
  export default class ITCasualDateParser extends AbstractParserWithWordBoundaryChecking {
10
10
  innerPattern(context: ParsingContext): RegExp {
@@ -14,28 +14,37 @@ export default class ITCasualDateParser extends AbstractParserWithWordBoundaryCh
14
14
  innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents | ParsingResult {
15
15
  let targetDate = context.refDate;
16
16
  const lowerText = match[0].toLowerCase();
17
- const component = context.createParsingComponents();
17
+ let component = context.createParsingComponents();
18
18
 
19
19
  switch (lowerText) {
20
+ case "adesso":
20
21
  case "ora":
21
- return references.now(context.reference);
22
+ component = references.now(context.reference);
23
+ break;
22
24
 
23
25
  case "oggi":
24
- return references.today(context.reference);
26
+ component = references.today(context.reference);
27
+ break;
25
28
 
26
29
  case "ieri":
27
- return references.yesterday(context.reference);
30
+ component = references.yesterday(context.reference);
31
+ break;
28
32
 
29
33
  case "domani":
30
- case "dmn":
31
- return references.tomorrow(context.reference);
34
+ component = references.tomorrow(context.reference);
35
+ break;
32
36
 
33
37
  case "stasera":
34
- case "questa sera":
35
- return references.tonight(context.reference);
38
+ case "stanotte":
39
+ component = references.tonight(context.reference);
40
+ break;
41
+
42
+ case "dopodomani":
43
+ component = references.theDayAfter(context.reference, 2);
44
+ break;
36
45
 
37
46
  default:
38
- if (lowerText.match(/ieri\s*sera/)) {
47
+ if (lowerText.match(/ieri\s*sera/) || lowerText.match(/ieri\s*notte/)) {
39
48
  if (targetDate.getHours() > 6) {
40
49
  const previousDay = new Date(targetDate.getTime());
41
50
  previousDay.setDate(previousDay.getDate() - 1);
@@ -45,10 +54,9 @@ export default class ITCasualDateParser extends AbstractParserWithWordBoundaryCh
45
54
  assignSimilarDate(component, targetDate);
46
55
  component.imply("hour", 0);
47
56
  }
48
-
49
57
  break;
50
58
  }
51
-
59
+ component.addTag("parser/ITCasualDateParser");
52
60
  return component;
53
61
  }
54
62
  }
@@ -1,57 +1,52 @@
1
1
  import { ParsingContext } from "../../../chrono";
2
- import { Meridiem } from "../../../index";
3
2
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
4
- import { assignSimilarDate, implySimilarTime } from "../../../utils/dates";
3
+ import * as casualReferences from "../../../common/casualReferences";
5
4
 
6
- const PATTERN = /(?:questo|questa)?\s{0,3}(mattina|pomeriggio|sera|notte|mezzanotte|mezzogiorno)(?=\W|$)/i;
5
+ const PATTERN =
6
+ /(stamattina|stasera|stanotte|stamani)|(questa\s*)?(mattina|pomeriggio|sera|notte|mezzanotte|mezzogiorno)(?=\W|$)/i;
7
7
 
8
8
  export default class ITCasualTimeParser extends AbstractParserWithWordBoundaryChecking {
9
9
  innerPattern() {
10
10
  return PATTERN;
11
11
  }
12
-
13
12
  innerExtract(context: ParsingContext, match: RegExpMatchArray) {
14
- const targetDate = context.refDate;
15
- const component = context.createParsingComponents();
16
-
17
- switch (match[1].toLowerCase()) {
18
- case "pomeriggio":
19
- component.imply("meridiem", Meridiem.PM);
20
- component.imply("hour", 15);
21
- component.addTag("casualReference/afternoon");
22
- break;
23
-
24
- case "sera":
25
- case "notte":
26
- component.imply("meridiem", Meridiem.PM);
27
- component.imply("hour", 20);
28
- component.addTag("casualReference/evening");
29
- break;
30
-
31
- case "mezzanotte":
32
- const nextDay = new Date(targetDate.getTime());
33
- nextDay.setDate(nextDay.getDate() + 1);
34
- assignSimilarDate(component, nextDay);
35
- implySimilarTime(component, nextDay);
36
- component.imply("hour", 0);
37
- component.imply("minute", 0);
38
- component.imply("second", 0);
39
- component.addTag("casualReference/midnight");
40
- break;
41
-
42
- case "mattina":
43
- component.imply("meridiem", Meridiem.AM);
44
- component.imply("hour", 6);
45
- component.addTag("casualReference/morning");
46
- break;
47
-
48
- case "mezzogiorno":
49
- component.imply("meridiem", Meridiem.AM);
50
- component.imply("hour", 12);
51
- component.addTag("casualReference/noon");
52
- break;
13
+ let component = null;
14
+
15
+ // Handle compound words like "stamattina", "stasera", etc.
16
+ if (match[1]) {
17
+ switch (match[1].toLowerCase()) {
18
+ case "stamattina":
19
+ case "stamani":
20
+ component = casualReferences.morning(context.reference);
21
+ break;
22
+ case "stasera":
23
+ case "stanotte":
24
+ component = casualReferences.evening(context.reference);
25
+ break;
26
+ }
27
+ } else if (match[3]) {
28
+ switch (match[3].toLowerCase()) {
29
+ case "pomeriggio":
30
+ component = casualReferences.afternoon(context.reference);
31
+ break;
32
+ case "sera":
33
+ case "notte":
34
+ component = casualReferences.evening(context.reference);
35
+ break;
36
+ case "mezzanotte":
37
+ component = casualReferences.midnight(context.reference);
38
+ break;
39
+ case "mattina":
40
+ component = casualReferences.morning(context.reference);
41
+ break;
42
+ case "mezzogiorno":
43
+ component = casualReferences.noon(context.reference);
44
+ break;
45
+ }
46
+ }
47
+ if (component) {
48
+ component.addTag("parser/ITCasualTimeParser");
53
49
  }
54
-
55
50
  return component;
56
51
  }
57
52
  }
@@ -9,17 +9,17 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
9
9
 
10
10
  // prettier-ignore
11
11
  const PATTERN = new RegExp(
12
- `(?:on\\s{0,3})?` +
12
+ `(?:il\\s{0,3})?` +
13
13
  `(${ORDINAL_NUMBER_PATTERN})` +
14
14
  `(?:` +
15
- `\\s{0,3}(?:al|\\-|\\–|fino|alle|allo)?\\s{0,3}` +
15
+ `\\s{0,3}(?:al|\\-|\\–|fino\\s*al?)?\\s{0,3}` +
16
16
  `(${ORDINAL_NUMBER_PATTERN})` +
17
17
  ")?" +
18
- `(?:-|/|\\s{0,3}(?:dal)?\\s{0,3})` +
18
+ `(?:-|/|\\s{0,3}(?:di)?\\s{0,3})` +
19
19
  `(${matchAnyPattern(MONTH_DICTIONARY)})` +
20
20
  "(?:" +
21
21
  `(?:-|/|,?\\s{0,3})` +
22
- `(${YEAR_PATTERN}(?![^\\s]\\d))` +
22
+ `(${YEAR_PATTERN}(?!\\w))` +
23
23
  ")?" +
24
24
  "(?=\\W|$)",
25
25
  "i"
@@ -30,7 +30,7 @@ const DATE_TO_GROUP = 2;
30
30
  const MONTH_NAME_GROUP = 3;
31
31
  const YEAR_GROUP = 4;
32
32
 
33
- export default class ENMonthNameLittleEndianParser extends AbstractParserWithWordBoundaryChecking {
33
+ export default class ITMonthNameLittleEndianParser extends AbstractParserWithWordBoundaryChecking {
34
34
  innerPattern(): RegExp {
35
35
  return PATTERN;
36
36
  }
@@ -41,7 +41,7 @@ export default class ENMonthNameLittleEndianParser extends AbstractParserWithWor
41
41
  const month = MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
42
42
  const day = parseOrdinalNumberPattern(match[DATE_GROUP]);
43
43
  if (day > 31) {
44
- // e.g. "[96 Aug]" => "9[6 Aug]", we need to shift away from the next number
44
+ // e.g. "[96 Ago]" => "9[6 Ago]", we need to shift away from the next number
45
45
  match.index = match.index + match[DATE_GROUP].length;
46
46
  return null;
47
47
  }
@@ -6,17 +6,18 @@ import { YEAR_PATTERN, parseYear } from "../constants";
6
6
  import { matchAnyPattern } from "../../../utils/pattern";
7
7
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
8
8
 
9
+ // prettier-ignore
9
10
  const PATTERN = new RegExp(
10
11
  `(${matchAnyPattern(MONTH_DICTIONARY)})` +
11
12
  "(?:-|/|\\s*,?\\s*)" +
12
13
  `(${ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*` +
13
14
  "(?:" +
14
- "(?:al|\\-|\\alle|\\del|\\s)\\s*" +
15
- `(${ORDINAL_NUMBER_PATTERN})\\s*` +
15
+ "(?:al|\\-)\\s*" +
16
+ `(${ORDINAL_NUMBER_PATTERN})\\s*` +
16
17
  ")?" +
17
18
  "(?:" +
18
- "(?:-|/|\\s*,?\\s*)" +
19
- `(${YEAR_PATTERN})` +
19
+ `(?:-|/|\\s*,\\s*|\\s+)` +
20
+ `(${YEAR_PATTERN})` +
20
21
  ")?" +
21
22
  "(?=\\W|$)(?!\\:\\d)",
22
23
  "i"
@@ -28,16 +29,24 @@ const DATE_TO_GROUP = 3;
28
29
  const YEAR_GROUP = 4;
29
30
 
30
31
  /**
31
- * The parser for parsing US's date format that begin with month's name.
32
- * - January 13
33
- * - January 13, 2012
34
- * - January 13 - 15, 2012
32
+ * The parser for parsing date format that begin with month's name.
33
+ * - Gennaio 13
34
+ * - Gennaio 13, 2012
35
+ * - Gennaio 13 - 15, 2012
35
36
  * Note: Watch out for:
36
- * - January 12:00
37
- * - January 12.44
38
- * - January 1222344
37
+ * - Gennaio 12:00
38
+ * - Gennaio 12.44
39
+ * - Gennaio 1222344
40
+ * - Gennaio 21 (when shouldSkipYearLikeDate=true)
39
41
  */
40
- export default class ENMonthNameMiddleEndianParser extends AbstractParserWithWordBoundaryChecking {
42
+ export default class ITMonthNameMiddleEndianParser extends AbstractParserWithWordBoundaryChecking {
43
+ shouldSkipYearLikeDate: boolean;
44
+
45
+ constructor(shouldSkipYearLikeDate: boolean) {
46
+ super();
47
+ this.shouldSkipYearLikeDate = shouldSkipYearLikeDate;
48
+ }
49
+
41
50
  innerPattern(): RegExp {
42
51
  return PATTERN;
43
52
  }
@@ -49,10 +58,18 @@ export default class ENMonthNameMiddleEndianParser extends AbstractParserWithWor
49
58
  return null;
50
59
  }
51
60
 
52
- const components = context.createParsingComponents({
53
- day: day,
54
- month: month,
55
- });
61
+ // Skip the case where the day looks like a year (ex: Gennaio 21)
62
+ if (this.shouldSkipYearLikeDate) {
63
+ if (!match[DATE_TO_GROUP] && !match[YEAR_GROUP] && match[DATE_GROUP].match(/^2[0-5]$/)) {
64
+ return null;
65
+ }
66
+ }
67
+ const components = context
68
+ .createParsingComponents({
69
+ day: day,
70
+ month: month,
71
+ })
72
+ .addTag("parser/ITMonthNameMiddleEndianParser");
56
73
 
57
74
  if (match[YEAR_GROUP]) {
58
75
  const year = parseYear(match[YEAR_GROUP]);
@@ -66,7 +83,7 @@ export default class ENMonthNameMiddleEndianParser extends AbstractParserWithWor
66
83
  return components;
67
84
  }
68
85
 
69
- // Text can be 'range' value. Such as 'January 12 - 13, 2012'
86
+ // Text can be 'range' value. Such as 'Gennaio 12 - 13, 2012'
70
87
  const endDate = parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
71
88
  const result = context.createParsingResult(match.index, match[0]);
72
89
  result.start = components;
@@ -6,11 +6,11 @@ import { YEAR_PATTERN, parseYear } from "../constants";
6
6
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
7
7
 
8
8
  const PATTERN = new RegExp(
9
- `((?:in)\\s*)?` +
9
+ `((?:a|in|di|del)\\s*)?` +
10
10
  `(${matchAnyPattern(MONTH_DICTIONARY)})` +
11
11
  `\\s*` +
12
12
  `(?:` +
13
- `[,-]?\\s*(${YEAR_PATTERN})?` +
13
+ `(?:,|-|del)?\\s*(${YEAR_PATTERN})?` +
14
14
  ")?" +
15
15
  "(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)",
16
16
  "i"
@@ -22,12 +22,12 @@ const YEAR_GROUP = 3;
22
22
 
23
23
  /**
24
24
  * The parser for parsing month name and year.
25
- * - January, 2012
26
- * - January 2012
27
- * - January
28
- * (in) Jan
25
+ * - Gennaio, 2012
26
+ * - Gennaio 2012
27
+ * - Gennaio
28
+ * (a/in/di/del) Gen
29
29
  */
30
- export default class ENMonthNameParser extends AbstractParserWithWordBoundaryChecking {
30
+ export default class ITMonthNameParser extends AbstractParserWithWordBoundaryChecking {
31
31
  innerPattern(): RegExp {
32
32
  return PATTERN;
33
33
  }
@@ -35,7 +35,7 @@ export default class ENMonthNameParser extends AbstractParserWithWordBoundaryChe
35
35
  innerExtract(context: ParsingContext, match: RegExpMatchArray) {
36
36
  const monthName = match[MONTH_NAME_GROUP].toLowerCase();
37
37
 
38
- // skip some unlikely words "jan", "mar", ..
38
+ // skip some unlikely words "gen", "mar", ..
39
39
  if (match[0].length <= 3 && !FULL_MONTH_NAME_DICTIONARY[monthName]) {
40
40
  return null;
41
41
  }
@@ -45,6 +45,7 @@ export default class ENMonthNameParser extends AbstractParserWithWordBoundaryChe
45
45
  match.index + match[0].length
46
46
  );
47
47
  result.start.imply("day", 1);
48
+ result.start.addTag("parser/ITMonthNameParser");
48
49
 
49
50
  const month = MONTH_DICTIONARY[monthName];
50
51
  result.start.assign("month", month);
@@ -4,15 +4,24 @@ import { ParsingComponents } from "../../../results";
4
4
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
5
5
  import { matchAnyPattern } from "../../../utils/pattern";
6
6
 
7
+ // Italian uses "il mese prossimo" (article + noun + modifier) more commonly than "il prossimo mese"
7
8
  const PATTERN = new RegExp(
8
- `(questo|ultimo|scorso|prossimo|dopo\\s*questo|questa|ultima|scorsa|prossima\\s*questa)\\s*(${matchAnyPattern(
9
- TIME_UNIT_DICTIONARY
10
- )})(?=\\s*)` + "(?=\\W|$)",
9
+ "(?:" +
10
+ // Pattern 1: "il prossimo mese" / "la prossima settimana" (modifier before noun)
11
+ `(?:il\\s*|la\\s*|l'\\s*)?(questo|questa|quest'|scorso|scorsa|prossimo|prossima|dopo\\s*questo|dopo\\s*questa)\\s*(${matchAnyPattern(TIME_UNIT_DICTIONARY)})` +
12
+ "|" +
13
+ // Pattern 2: "il mese prossimo" / "la settimana scorsa" (modifier after noun)
14
+ `(?:il\\s*|la\\s*|l'\\s*)(${matchAnyPattern(TIME_UNIT_DICTIONARY)})\\s*(scorso|scorsa|prossimo|prossima)` +
15
+ ")(?=\\W|$)",
11
16
  "i"
12
17
  );
13
18
 
14
- const MODIFIER_WORD_GROUP = 1;
15
- const RELATIVE_WORD_GROUP = 2;
19
+ // Pattern 1 groups
20
+ const MODIFIER_WORD_GROUP_1 = 1;
21
+ const RELATIVE_WORD_GROUP_1 = 2;
22
+ // Pattern 2 groups
23
+ const RELATIVE_WORD_GROUP_2 = 3;
24
+ const MODIFIER_WORD_GROUP_2 = 4;
16
25
 
17
26
  export default class ITRelativeDateFormatParser extends AbstractParserWithWordBoundaryChecking {
18
27
  innerPattern(): RegExp {
@@ -20,17 +29,29 @@ export default class ITRelativeDateFormatParser extends AbstractParserWithWordBo
20
29
  }
21
30
 
22
31
  innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents {
23
- const modifier = match[MODIFIER_WORD_GROUP].toLowerCase();
24
- const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase();
32
+ // Determine which pattern matched
33
+ let modifier: string;
34
+ let unitWord: string;
35
+
36
+ if (match[MODIFIER_WORD_GROUP_1]) {
37
+ // Pattern 1: "il prossimo mese"
38
+ modifier = match[MODIFIER_WORD_GROUP_1].toLowerCase();
39
+ unitWord = match[RELATIVE_WORD_GROUP_1].toLowerCase();
40
+ } else {
41
+ // Pattern 2: "il mese prossimo"
42
+ modifier = match[MODIFIER_WORD_GROUP_2].toLowerCase();
43
+ unitWord = match[RELATIVE_WORD_GROUP_2].toLowerCase();
44
+ }
45
+
25
46
  const timeunit = TIME_UNIT_DICTIONARY[unitWord];
26
47
 
27
- if (modifier == "prossimo" || modifier.startsWith("dopo")) {
48
+ if (modifier == "prossimo" || modifier == "prossima" || modifier.startsWith("dopo")) {
28
49
  const timeUnits = {};
29
50
  timeUnits[timeunit] = 1;
30
51
  return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
31
52
  }
32
53
 
33
- if (modifier == "prima" || modifier == "precedente") {
54
+ if (modifier == "scorso" || modifier == "scorsa") {
34
55
  const timeUnits = {};
35
56
  timeUnits[timeunit] = -1;
36
57
  return ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
@@ -39,7 +60,7 @@ export default class ITRelativeDateFormatParser extends AbstractParserWithWordBo
39
60
  const components = context.createParsingComponents();
40
61
  let date = new Date(context.reference.instant.getTime());
41
62
 
42
- // This week
63
+ // Questa settimana
43
64
  if (unitWord.match(/settimana/i)) {
44
65
  date.setDate(date.getDate() - date.getDay());
45
66
  components.imply("day", date.getDate());
@@ -47,7 +68,7 @@ export default class ITRelativeDateFormatParser extends AbstractParserWithWordBo
47
68
  components.imply("year", date.getFullYear());
48
69
  }
49
70
 
50
- // This month
71
+ // Questo mese
51
72
  else if (unitWord.match(/mese/i)) {
52
73
  date.setDate(1);
53
74
  components.imply("day", date.getDate());
@@ -55,7 +76,7 @@ export default class ITRelativeDateFormatParser extends AbstractParserWithWordBo
55
76
  components.assign("month", date.getMonth() + 1);
56
77
  }
57
78
 
58
- // This year
79
+ // Quest'anno
59
80
  else if (unitWord.match(/anno/i)) {
60
81
  date.setDate(1);
61
82
  date.setMonth(0);
@@ -12,7 +12,7 @@ const YEAR_GROUP = 2;
12
12
  * - 11/05
13
13
  * - 06/2005
14
14
  */
15
- export default class ENSlashMonthFormatParser extends AbstractParserWithWordBoundaryChecking {
15
+ export default class ITSlashMonthFormatParser extends AbstractParserWithWordBoundaryChecking {
16
16
  innerPattern(): RegExp {
17
17
  return PATTERN;
18
18
  }
@@ -1,55 +1,69 @@
1
1
  import { ParsingContext } from "../../../chrono";
2
- import { ParsingComponents } from "../../../results";
3
- import { Meridiem } from "../../../index";
2
+ import { ParsingComponents, ParsingResult } from "../../../results";
3
+ import { Meridiem } from "../../../types";
4
4
  import { AbstractTimeExpressionParser } from "../../../common/parsers/AbstractTimeExpressionParser";
5
5
 
6
- export default class ENTimeExpressionParser extends AbstractTimeExpressionParser {
6
+ export default class ITTimeExpressionParser extends AbstractTimeExpressionParser {
7
7
  constructor(strictMode) {
8
8
  super(strictMode);
9
9
  }
10
10
 
11
11
  followingPhase(): string {
12
- return "\\s*(?:\\-|\\–|\\~|\\〜|to|\\?)\\s*";
12
+ return "\\s*(?:\\-|\\–|\\~|\\〜|a|fino\\s*a|alle?|\\?)\\s*";
13
13
  }
14
14
 
15
15
  primaryPrefix(): string {
16
- return "(?:(?:alle|dalle)\\s*)??";
16
+ return "(?:(?:alle?|dalle?)\\s*)??";
17
17
  }
18
18
 
19
19
  primarySuffix(): string {
20
- return "(?:\\s*(?:in punto|o\\W*in punto|(?:di|del|della|in|al|alla|alle)\\s*(?:mattina|pomeriggio|sera)))?(?!/)(?=\\W|$)";
20
+ return "(?:\\s*(?:di\\s*(?:sera|notte|mattina|pomeriggio)))?(?!/)(?=\\W|$)";
21
21
  }
22
22
 
23
23
  extractPrimaryTimeComponents(context: ParsingContext, match: RegExpMatchArray): null | ParsingComponents {
24
24
  const components = super.extractPrimaryTimeComponents(context, match);
25
- if (components) {
26
- if (match[0].endsWith("sera")) {
27
- const hour = components.get("hour");
28
- if (hour >= 6 && hour < 12) {
29
- components.assign("hour", components.get("hour") + 12);
30
- components.assign("meridiem", Meridiem.PM);
31
- } else if (hour < 6) {
32
- components.assign("meridiem", Meridiem.AM);
33
- }
34
- }
25
+ if (!components) {
26
+ return components;
27
+ }
35
28
 
36
- if (match[0].endsWith("pomeriggio")) {
29
+ if (match[0].match(/di\s*(?:sera|notte)/i)) {
30
+ const hour = components.get("hour");
31
+ if (hour >= 6 && hour < 12) {
32
+ components.assign("hour", components.get("hour") + 12);
37
33
  components.assign("meridiem", Meridiem.PM);
38
- const hour = components.get("hour");
39
- if (hour >= 0 && hour <= 6) {
40
- components.assign("hour", components.get("hour") + 12);
41
- }
34
+ } else if (hour < 6) {
35
+ components.assign("meridiem", Meridiem.AM);
42
36
  }
37
+ }
43
38
 
44
- if (match[0].endsWith("mattina")) {
45
- components.assign("meridiem", Meridiem.AM);
46
- const hour = components.get("hour");
47
- if (hour < 12) {
48
- components.assign("hour", components.get("hour"));
49
- }
39
+ if (match[0].match(/di\s*pomeriggio/i)) {
40
+ components.assign("meridiem", Meridiem.PM);
41
+ const hour = components.get("hour");
42
+ if (hour >= 0 && hour <= 6) {
43
+ components.assign("hour", components.get("hour") + 12);
50
44
  }
51
45
  }
52
46
 
53
- return components;
47
+ if (match[0].match(/di\s*mattina/i)) {
48
+ components.assign("meridiem", Meridiem.AM);
49
+ const hour = components.get("hour");
50
+ if (hour < 12) {
51
+ components.assign("hour", components.get("hour"));
52
+ }
53
+ }
54
+
55
+ return components.addTag("parser/ITTimeExpressionParser");
56
+ }
57
+
58
+ extractFollowingTimeComponents(
59
+ context: ParsingContext,
60
+ match: RegExpMatchArray,
61
+ result: ParsingResult
62
+ ): ParsingComponents | null {
63
+ const followingComponents = super.extractFollowingTimeComponents(context, match, result);
64
+ if (followingComponents) {
65
+ followingComponents.addTag("parser/ITTimeExpressionParser");
66
+ }
67
+ return followingComponents;
54
68
  }
55
69
  }