chrono-node 2.3.9 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/chrono.iml +13 -0
- package/.idea/compiler.xml +7 -0
- package/.idea/dictionaries/wanasit.xml +8 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +320 -0
- package/README.md +1 -1
- package/benchmark/results/chrono.chart.html +111 -0
- package/coverage/clover.xml +4589 -0
- package/coverage/coverage-final.json +138 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +641 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/results.ts.html +701 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/calculation/index.html +131 -0
- package/coverage/lcov-report/src/calculation/mergingCalculation.ts.html +319 -0
- package/coverage/lcov-report/src/calculation/weeks.ts.html +199 -0
- package/coverage/lcov-report/src/calculation/yearCalculation.ts.html +194 -0
- package/coverage/lcov-report/src/calculation/years.ts.html +199 -0
- package/coverage/lcov-report/src/chrono.js.html +368 -0
- package/coverage/lcov-report/src/chrono.ts.html +649 -0
- package/coverage/lcov-report/src/common/abstractRefiners.ts.html +286 -0
- package/coverage/lcov-report/src/common/calculation/index.html +116 -0
- package/coverage/lcov-report/src/common/calculation/weekdays.ts.html +352 -0
- package/coverage/lcov-report/src/common/casualReferences.ts.html +412 -0
- package/coverage/lcov-report/src/common/index.html +131 -0
- package/coverage/lcov-report/src/common/parsers/AbstractParserWithWordBoundary.ts.html +214 -0
- package/coverage/lcov-report/src/common/parsers/AbstractTimeExpressionParser.ts.html +1384 -0
- package/coverage/lcov-report/src/common/parsers/ISOFormatParser.ts.html +340 -0
- package/coverage/lcov-report/src/common/parsers/SlashDateFormatParser.ts.html +385 -0
- package/coverage/lcov-report/src/common/parsers/index.html +161 -0
- package/coverage/lcov-report/src/common/refiners/AbstractMergeDateRangeRefiner.ts.html +268 -0
- package/coverage/lcov-report/src/common/refiners/AbstractMergeDateTimeRefiner.ts.html +172 -0
- package/coverage/lcov-report/src/common/refiners/ExtractTimezoneAbbrRefiner.ts.html +883 -0
- package/coverage/lcov-report/src/common/refiners/ExtractTimezoneOffsetRefiner.ts.html +226 -0
- package/coverage/lcov-report/src/common/refiners/ForwardDateRefiner.ts.html +334 -0
- package/coverage/lcov-report/src/common/refiners/MergeWeekdayComponentRefiner.ts.html +187 -0
- package/coverage/lcov-report/src/common/refiners/OverlapRemovalRefiner.ts.html +199 -0
- package/coverage/lcov-report/src/common/refiners/UnlikelyFormatFilter.ts.html +265 -0
- package/coverage/lcov-report/src/common/refiners/index.html +221 -0
- package/coverage/lcov-report/src/configurations.ts.html +154 -0
- package/coverage/lcov-report/src/debugging.ts.html +154 -0
- package/coverage/lcov-report/src/index.html +191 -0
- package/coverage/lcov-report/src/index.ts.html +517 -0
- package/coverage/lcov-report/src/locales/de/constants.ts.html +664 -0
- package/coverage/lcov-report/src/locales/de/index.html +131 -0
- package/coverage/lcov-report/src/locales/de/index.ts.html +238 -0
- package/coverage/lcov-report/src/locales/de/parsers/DECasualDateParser.ts.html +325 -0
- package/coverage/lcov-report/src/locales/de/parsers/DECasualTimeParser.ts.html +325 -0
- package/coverage/lcov-report/src/locales/de/parsers/DEMonthNameLittleEndianParser.ts.html +268 -0
- package/coverage/lcov-report/src/locales/de/parsers/DESpecificTimeExpressionParser.ts.html +535 -0
- package/coverage/lcov-report/src/locales/de/parsers/DETimeExpressionParser.ts.html +151 -0
- package/coverage/lcov-report/src/locales/de/parsers/DETimeUnitRelativeFormatParser.ts.html +211 -0
- package/coverage/lcov-report/src/locales/de/parsers/DEWeekdayParser.ts.html +232 -0
- package/coverage/lcov-report/src/locales/de/parsers/index.html +206 -0
- package/coverage/lcov-report/src/locales/de/refiners/DEMergeDateRangeRefiner.ts.html +130 -0
- package/coverage/lcov-report/src/locales/de/refiners/DEMergeDateTimeRefiner.ts.html +115 -0
- package/coverage/lcov-report/src/locales/de/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/en/constants.ts.html +841 -0
- package/coverage/lcov-report/src/locales/en/index.html +131 -0
- package/coverage/lcov-report/src/locales/en/index.ts.html +382 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENCasualDateParser.ts.html +244 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENCasualTimeParser.ts.html +238 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENCasualYearMonthDayParser.ts.html +232 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENDeadlineFormatParser.ts.html +311 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENISOFormatParser.ts.html +317 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENMonthNameLittleEndianParser.ts.html +292 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENMonthNameMiddleEndianParser.ts.html +319 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENMonthNameParser.ts.html +271 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENRelativeDateFormatParser.ts.html +292 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENSlashDateFormatParser.ts.html +443 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENSlashDateFormatStartWithYearParser.ts.html +221 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENSlashMonthFormatParser.ts.html +163 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeExpressionParser.ts.html +250 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeUnitAgoFormatParser.ts.html +160 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.ts.html +166 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeUnitDeadlineFormatParser.ts.html +149 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeUnitLaterFormatParser.ts.html +166 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENTimeUnitWithinFormatParser.ts.html +163 -0
- package/coverage/lcov-report/src/locales/en/parsers/ENWeekdayParser.ts.html +229 -0
- package/coverage/lcov-report/src/locales/en/parsers/index.html +311 -0
- package/coverage/lcov-report/src/locales/en/refiners/ENMergeDateRangeRefiner.ts.html +136 -0
- package/coverage/lcov-report/src/locales/en/refiners/ENMergeDateTimeRefiner.ts.html +124 -0
- package/coverage/lcov-report/src/locales/en/refiners/ENMergeRelativeDateRefiner.ts.html +259 -0
- package/coverage/lcov-report/src/locales/en/refiners/index.html +146 -0
- package/coverage/lcov-report/src/locales/fr/constants.ts.html +637 -0
- package/coverage/lcov-report/src/locales/fr/index.html +131 -0
- package/coverage/lcov-report/src/locales/fr/index.ts.html +280 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRCasualDateParser.ts.html +223 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRCasualTimeParser.ts.html +232 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRMonthNameLittleEndianParser.ts.html +277 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRSpecificTimeExpressionParser.ts.html +484 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRTimeExpressionParser.ts.html +151 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRTimeUnitAgoFormatParser.ts.html +151 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRTimeUnitRelativeFormatParser.ts.html +214 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRTimeUnitWithinFormatParser.ts.html +130 -0
- package/coverage/lcov-report/src/locales/fr/parsers/FRWeekdayParser.ts.html +223 -0
- package/coverage/lcov-report/src/locales/fr/parsers/index.html +236 -0
- package/coverage/lcov-report/src/locales/fr/refiners/FRMergeDateRangeRefiner.ts.html +130 -0
- package/coverage/lcov-report/src/locales/fr/refiners/FRMergeDateTimeRefiner.ts.html +115 -0
- package/coverage/lcov-report/src/locales/fr/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/ja/constants.ts.html +157 -0
- package/coverage/lcov-report/src/locales/ja/index.html +131 -0
- package/coverage/lcov-report/src/locales/ja/index.ts.html +214 -0
- package/coverage/lcov-report/src/locales/ja/parsers/JPCasualDateParser.ts.html +217 -0
- package/coverage/lcov-report/src/locales/ja/parsers/JPStandardParser.ts.html +247 -0
- package/coverage/lcov-report/src/locales/ja/parsers/index.html +131 -0
- package/coverage/lcov-report/src/locales/ja/refiners/JPMergeDateRangeRefiner.ts.html +124 -0
- package/coverage/lcov-report/src/locales/ja/refiners/index.html +116 -0
- package/coverage/lcov-report/src/locales/nl/constants.ts.html +796 -0
- package/coverage/lcov-report/src/locales/nl/index.html +131 -0
- package/coverage/lcov-report/src/locales/nl/index.ts.html +304 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLCasualDateParser.ts.html +181 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLCasualDateTimeParser.ts.html +310 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLCasualTimeParser.ts.html +265 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLCasualYearMonthDayParser.ts.html +232 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLMonthNameMiddleEndianParser.ts.html +349 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLMonthNameParser.ts.html +235 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLRelativeDateFormatParser.ts.html +295 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLSlashMonthFormatParser.ts.html +163 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLTimeExpressionParser.ts.html +163 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLTimeUnitAgoFormatParser.ts.html +163 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLTimeUnitCasualRelativeFormatParser.ts.html +166 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLTimeUnitLaterFormatParser.ts.html +166 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLTimeUnitWithinFormatParser.ts.html +130 -0
- package/coverage/lcov-report/src/locales/nl/parsers/NLWeekdayParser.ts.html +223 -0
- package/coverage/lcov-report/src/locales/nl/parsers/index.html +311 -0
- package/coverage/lcov-report/src/locales/nl/refiners/NLMergeDateRangeRefiner.ts.html +136 -0
- package/coverage/lcov-report/src/locales/nl/refiners/NLMergeDateTimeRefiner.ts.html +124 -0
- package/coverage/lcov-report/src/locales/nl/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/pt/constants.ts.html +343 -0
- package/coverage/lcov-report/src/locales/pt/index.html +131 -0
- package/coverage/lcov-report/src/locales/pt/index.ts.html +256 -0
- package/coverage/lcov-report/src/locales/pt/parsers/PTCasualDateParser.ts.html +181 -0
- package/coverage/lcov-report/src/locales/pt/parsers/PTCasualTimeParser.ts.html +226 -0
- package/coverage/lcov-report/src/locales/pt/parsers/PTMonthNameLittleEndianParser.ts.html +265 -0
- package/coverage/lcov-report/src/locales/pt/parsers/PTTimeExpressionParser.ts.html +145 -0
- package/coverage/lcov-report/src/locales/pt/parsers/PTWeekdayParser.ts.html +235 -0
- package/coverage/lcov-report/src/locales/pt/parsers/index.html +176 -0
- package/coverage/lcov-report/src/locales/pt/refiners/PTMergeDateRangeRefiner.ts.html +130 -0
- package/coverage/lcov-report/src/locales/pt/refiners/PTMergeDateTimeRefiner.ts.html +115 -0
- package/coverage/lcov-report/src/locales/pt/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/ru/constants.ts.html +1111 -0
- package/coverage/lcov-report/src/locales/ru/index.html +131 -0
- package/coverage/lcov-report/src/locales/ru/index.ts.html +337 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUCasualDateParser.ts.html +217 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUCasualTimeParser.ts.html +253 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUMonthNameLittleEndianParser.ts.html +301 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUMonthNameParser.ts.html +268 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RURelativeDateFormatParser.ts.html +310 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUTimeExpressionParser.ts.html +277 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUTimeUnitAgoFormatParser.ts.html +157 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUTimeUnitCasualRelativeFormatParser.ts.html +187 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUTimeUnitWithinFormatParser.ts.html +157 -0
- package/coverage/lcov-report/src/locales/ru/parsers/RUWeekdayParser.ts.html +256 -0
- package/coverage/lcov-report/src/locales/ru/parsers/index.html +251 -0
- package/coverage/lcov-report/src/locales/ru/refiners/RUMergeDateRangeRefiner.ts.html +124 -0
- package/coverage/lcov-report/src/locales/ru/refiners/RUMergeDateTimeRefiner.ts.html +124 -0
- package/coverage/lcov-report/src/locales/ru/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/zh/hans/constants.ts.html +241 -0
- package/coverage/lcov-report/src/locales/zh/hans/index.html +131 -0
- package/coverage/lcov-report/src/locales/zh/hans/index.ts.html +271 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansCasualDateParser.ts.html +469 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansDateParser.ts.html +310 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansDeadlineFormatParser.ts.html +328 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansRelationWeekdayParser.ts.html +292 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansTimeExpressionParser.ts.html +1357 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/ZHHansWeekdayParser.ts.html +223 -0
- package/coverage/lcov-report/src/locales/zh/hans/parsers/index.html +191 -0
- package/coverage/lcov-report/src/locales/zh/hans/refiners/ZHHansMergeDateRangeRefiner.ts.html +106 -0
- package/coverage/lcov-report/src/locales/zh/hans/refiners/ZHHansMergeDateTimeRefiner.ts.html +106 -0
- package/coverage/lcov-report/src/locales/zh/hans/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/zh/hant/constants.ts.html +244 -0
- package/coverage/lcov-report/src/locales/zh/hant/index.html +131 -0
- package/coverage/lcov-report/src/locales/zh/hant/index.ts.html +274 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantCasualDateParser.ts.html +469 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantDateParser.ts.html +289 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantDeadlineFormatParser.ts.html +328 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantRelationWeekdayParser.ts.html +292 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantTimeExpressionParser.ts.html +1357 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/ZHHantWeekdayParser.ts.html +223 -0
- package/coverage/lcov-report/src/locales/zh/hant/parsers/index.html +191 -0
- package/coverage/lcov-report/src/locales/zh/hant/refiners/ZHHantMergeDateRangeRefiner.ts.html +106 -0
- package/coverage/lcov-report/src/locales/zh/hant/refiners/ZHHantMergeDateTimeRefiner.ts.html +106 -0
- package/coverage/lcov-report/src/locales/zh/hant/refiners/index.html +131 -0
- package/coverage/lcov-report/src/locales/zh/index.html +116 -0
- package/coverage/lcov-report/src/locales/zh/index.ts.html +91 -0
- package/coverage/lcov-report/src/options.js.html +1085 -0
- package/coverage/lcov-report/src/parsers/de/DECasualDateParser.js.html +368 -0
- package/coverage/lcov-report/src/parsers/de/DEDeadlineFormatParser.js.html +374 -0
- package/coverage/lcov-report/src/parsers/de/DEMonthNameLittleEndianParser.js.html +347 -0
- package/coverage/lcov-report/src/parsers/de/DEMonthNameParser.js.html +329 -0
- package/coverage/lcov-report/src/parsers/de/DESlashDateFormatParser.js.html +398 -0
- package/coverage/lcov-report/src/parsers/de/DETimeAgoFormatParser.js.html +401 -0
- package/coverage/lcov-report/src/parsers/de/DETimeExpressionParser.js.html +836 -0
- package/coverage/lcov-report/src/parsers/de/DEWeekdayParser.js.html +338 -0
- package/coverage/lcov-report/src/parsers/de/index.html +216 -0
- package/coverage/lcov-report/src/parsers/en/ENCasualDateParser.js.html +275 -0
- package/coverage/lcov-report/src/parsers/en/ENCasualTimeParser.js.html +242 -0
- package/coverage/lcov-report/src/parsers/en/ENDeadlineFormatParser.js.html +359 -0
- package/coverage/lcov-report/src/parsers/en/ENISOFormatParser.js.html +389 -0
- package/coverage/lcov-report/src/parsers/en/ENMonthNameLittleEndianParser.js.html +416 -0
- package/coverage/lcov-report/src/parsers/en/ENMonthNameMiddleEndianParser.js.html +437 -0
- package/coverage/lcov-report/src/parsers/en/ENMonthNameParser.js.html +320 -0
- package/coverage/lcov-report/src/parsers/en/ENRelativeDateFormatParser.js.html +518 -0
- package/coverage/lcov-report/src/parsers/en/ENSlashDateFormatParser.js.html +479 -0
- package/coverage/lcov-report/src/parsers/en/ENSlashDateFormatStartWithYearParser.js.html +245 -0
- package/coverage/lcov-report/src/parsers/en/ENSlashMonthFormatParser.js.html +221 -0
- package/coverage/lcov-report/src/parsers/en/ENTimeAgoFormatParser.js.html +287 -0
- package/coverage/lcov-report/src/parsers/en/ENTimeExpressionParser.js.html +869 -0
- package/coverage/lcov-report/src/parsers/en/ENTimeLaterFormatParser.js.html +305 -0
- package/coverage/lcov-report/src/parsers/en/ENWeekdayParser.js.html +356 -0
- package/coverage/lcov-report/src/parsers/en/index.html +321 -0
- package/coverage/lcov-report/src/parsers/es/ESCasualDateParser.js.html +452 -0
- package/coverage/lcov-report/src/parsers/es/ESDeadlineFormatParser.js.html +260 -0
- package/coverage/lcov-report/src/parsers/es/ESMonthNameLittleEndianParser.js.html +338 -0
- package/coverage/lcov-report/src/parsers/es/ESSlashDateFormatParser.js.html +419 -0
- package/coverage/lcov-report/src/parsers/es/ESTimeAgoFormatParser.js.html +341 -0
- package/coverage/lcov-report/src/parsers/es/ESTimeExpressionParser.js.html +782 -0
- package/coverage/lcov-report/src/parsers/es/ESWeekdayParser.js.html +260 -0
- package/coverage/lcov-report/src/parsers/es/index.html +201 -0
- package/coverage/lcov-report/src/parsers/fr/FRCasualDateParser.js.html +311 -0
- package/coverage/lcov-report/src/parsers/fr/FRDeadlineFormatParser.js.html +359 -0
- package/coverage/lcov-report/src/parsers/fr/FRMonthNameLittleEndianParser.js.html +338 -0
- package/coverage/lcov-report/src/parsers/fr/FRRelativeDateFormatParser.js.html +545 -0
- package/coverage/lcov-report/src/parsers/fr/FRSlashDateFormatParser.js.html +437 -0
- package/coverage/lcov-report/src/parsers/fr/FRTimeAgoFormatParser.js.html +341 -0
- package/coverage/lcov-report/src/parsers/fr/FRTimeExpressionParser.js.html +803 -0
- package/coverage/lcov-report/src/parsers/fr/FRWeekdayParser.js.html +257 -0
- package/coverage/lcov-report/src/parsers/fr/index.html +216 -0
- package/coverage/lcov-report/src/parsers/index.html +111 -0
- package/coverage/lcov-report/src/parsers/ja/JPCasualDateParser.js.html +245 -0
- package/coverage/lcov-report/src/parsers/ja/JPStandardParser.js.html +293 -0
- package/coverage/lcov-report/src/parsers/ja/index.html +126 -0
- package/coverage/lcov-report/src/parsers/nl/NLCasualDateParser.js.html +395 -0
- package/coverage/lcov-report/src/parsers/nl/NLCasualTimeParser.js.html +278 -0
- package/coverage/lcov-report/src/parsers/nl/NLMonthNameLittleEndianParser.js.html +383 -0
- package/coverage/lcov-report/src/parsers/nl/NLMonthNameParser.js.html +320 -0
- package/coverage/lcov-report/src/parsers/nl/NLSlashDateFormatParser.js.html +389 -0
- package/coverage/lcov-report/src/parsers/nl/NLTimeExpressionParser.js.html +836 -0
- package/coverage/lcov-report/src/parsers/nl/NLWeekdayParser.js.html +377 -0
- package/coverage/lcov-report/src/parsers/nl/index.html +201 -0
- package/coverage/lcov-report/src/parsers/parser.js.html +500 -0
- package/coverage/lcov-report/src/parsers/pt/PTCasualDateParser.js.html +449 -0
- package/coverage/lcov-report/src/parsers/pt/PTDeadlineFormatParser.js.html +263 -0
- package/coverage/lcov-report/src/parsers/pt/PTMonthNameLittleEndianParser.js.html +338 -0
- package/coverage/lcov-report/src/parsers/pt/PTSlashDateFormatParser.js.html +419 -0
- package/coverage/lcov-report/src/parsers/pt/PTTimeAgoFormatParser.js.html +341 -0
- package/coverage/lcov-report/src/parsers/pt/PTTimeExpressionParser.js.html +782 -0
- package/coverage/lcov-report/src/parsers/pt/PTWeekdayParser.js.html +260 -0
- package/coverage/lcov-report/src/parsers/pt/index.html +201 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/ZHHantCasualDateParser.js.html +494 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/ZHHantDateParser.js.html +281 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/ZHHantDeadlineFormatParser.js.html +353 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/ZHHantTimeExpressionParser.js.html +1346 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/ZHHantWeekdayParser.js.html +239 -0
- package/coverage/lcov-report/src/parsers/zh-Hant/index.html +171 -0
- package/coverage/lcov-report/src/refiners/ExtractTimezoneAbbrRefiner.js.html +245 -0
- package/coverage/lcov-report/src/refiners/ExtractTimezoneOffsetRefiner.js.html +218 -0
- package/coverage/lcov-report/src/refiners/ForwardDateRefiner.js.html +239 -0
- package/coverage/lcov-report/src/refiners/OverlapRemovalRefiner.js.html +200 -0
- package/coverage/lcov-report/src/refiners/UnlikelyFormatFilter.js.html +131 -0
- package/coverage/lcov-report/src/refiners/de/DEMergeDateRangeRefiner.js.html +116 -0
- package/coverage/lcov-report/src/refiners/de/DEMergeDateTimeRefiner.js.html +377 -0
- package/coverage/lcov-report/src/refiners/de/index.html +126 -0
- package/coverage/lcov-report/src/refiners/en/ENMergeDateRangeRefiner.js.html +416 -0
- package/coverage/lcov-report/src/refiners/en/ENMergeDateTimeRefiner.js.html +533 -0
- package/coverage/lcov-report/src/refiners/en/ENPrioritizeSpecificDateRefiner.js.html +422 -0
- package/coverage/lcov-report/src/refiners/en/index.html +141 -0
- package/coverage/lcov-report/src/refiners/fr/FRMergeDateRangeRefiner.js.html +374 -0
- package/coverage/lcov-report/src/refiners/fr/FRMergeDateTimeRefiner.js.html +395 -0
- package/coverage/lcov-report/src/refiners/fr/index.html +126 -0
- package/coverage/lcov-report/src/refiners/index.html +186 -0
- package/coverage/lcov-report/src/refiners/ja/JPMergeDateRangeRefiner.js.html +113 -0
- package/coverage/lcov-report/src/refiners/ja/index.html +111 -0
- package/coverage/lcov-report/src/refiners/nl/NLMergeDateRangeRefiner.js.html +116 -0
- package/coverage/lcov-report/src/refiners/nl/NLMergeDateTimeRefiner.js.html +362 -0
- package/coverage/lcov-report/src/refiners/nl/index.html +126 -0
- package/coverage/lcov-report/src/refiners/refiner.js.html +239 -0
- package/coverage/lcov-report/src/result.js.html +545 -0
- package/coverage/lcov-report/src/results.ts.html +916 -0
- package/coverage/lcov-report/src/timezone.ts.html +700 -0
- package/coverage/lcov-report/src/utils/DE.js.html +308 -0
- package/coverage/lcov-report/src/utils/EN.js.html +596 -0
- package/coverage/lcov-report/src/utils/ES.js.html +254 -0
- package/coverage/lcov-report/src/utils/FR.js.html +302 -0
- package/coverage/lcov-report/src/utils/JP.js.html +215 -0
- package/coverage/lcov-report/src/utils/NL.js.html +620 -0
- package/coverage/lcov-report/src/utils/PT.js.html +263 -0
- package/coverage/lcov-report/src/utils/ParserWithWordEndingDetection.ts.html +176 -0
- package/coverage/lcov-report/src/utils/ZH-Hant.js.html +236 -0
- package/coverage/lcov-report/src/utils/dayjs.ts.html +223 -0
- package/coverage/lcov-report/src/utils/index.html +146 -0
- package/coverage/lcov-report/src/utils/pattern.ts.html +175 -0
- package/coverage/lcov-report/src/utils/timeunits.ts.html +199 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov-report/test/test_util.js.html +299 -0
- package/coverage/lcov-report/test/test_util.ts.html +490 -0
- package/coverage/lcov.info +7750 -0
- package/dist/chrono.js.map +1 -1
- package/dist/common/calculation/weekdays.d.ts +7 -0
- package/dist/common/calculation/weekdays.js +68 -0
- package/dist/common/calculation/weekdays.js.map +1 -0
- package/dist/common/parsers/SlashDateFormatParser.js +5 -3
- package/dist/common/parsers/SlashDateFormatParser.js.map +1 -1
- package/dist/common/refiners/AbstractMergeDateTimeRefiner.d.ts +1 -1
- package/dist/common/refiners/AbstractMergeDateTimeRefiner.js +2 -2
- package/dist/common/refiners/AbstractMergeDateTimeRefiner.js.map +1 -1
- package/dist/common/refiners/ForwardDateRefiner.js +12 -0
- package/dist/common/refiners/ForwardDateRefiner.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/locales/de/parsers/DEWeekdayParser.js +2 -8
- package/dist/locales/de/parsers/DEWeekdayParser.js.map +1 -1
- package/dist/locales/en/constants.d.ts +2 -1
- package/dist/locales/en/constants.js.map +1 -1
- package/dist/locales/en/parsers/ENCasualTimeParser.js +4 -4
- package/dist/locales/en/parsers/ENCasualTimeParser.js.map +1 -1
- package/dist/locales/en/parsers/ENWeekdayParser.js +3 -9
- package/dist/locales/en/parsers/ENWeekdayParser.js.map +1 -1
- package/dist/locales/fr/parsers/FRWeekdayParser.js +4 -10
- package/dist/locales/fr/parsers/FRWeekdayParser.js.map +1 -1
- package/dist/locales/nl/parsers/NLWeekdayParser.js +3 -9
- package/dist/locales/nl/parsers/NLWeekdayParser.js.map +1 -1
- package/dist/locales/pt/parsers/PTWeekdayParser.js +4 -10
- package/dist/locales/pt/parsers/PTWeekdayParser.js.map +1 -1
- package/dist/locales/ru/constants.js +4 -5
- package/dist/locales/ru/constants.js.map +1 -1
- package/dist/locales/ru/parsers/RUWeekdayParser.js +3 -9
- package/dist/locales/ru/parsers/RUWeekdayParser.js.map +1 -1
- package/dist/locales/ru/refiners/RUMergeDateRangeRefiner.d.ts +1 -1
- package/dist/locales/ru/refiners/RUMergeDateRangeRefiner.js +2 -2
- package/dist/locales/ru/refiners/RUMergeDateRangeRefiner.js.map +1 -1
- package/dist/locales/zh/hans/parsers/ZHHansTimeExpressionParser.js +26 -26
- package/dist/locales/zh/hans/parsers/ZHHansTimeExpressionParser.js.map +1 -1
- package/dist/locales/zh/hant/parsers/ZHHantTimeExpressionParser.js +26 -26
- package/dist/locales/zh/hant/parsers/ZHHantTimeExpressionParser.js.map +1 -1
- package/dist/results.d.ts +2 -1
- package/dist/results.js +14 -10
- package/dist/results.js.map +1 -1
- package/dist/utils/dayjs.d.ts +2 -0
- package/dist/utils/dayjs.js +13 -1
- package/dist/utils/dayjs.js.map +1 -1
- package/docs/assets/css/main.css +2660 -0
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +248 -0
- package/docs/assets/js/search.js +1 -0
- package/docs/classes/chrono.html +377 -0
- package/docs/enums/meridiem.html +191 -0
- package/docs/index.html +329 -0
- package/docs/interfaces/parsedcomponents.html +270 -0
- package/docs/interfaces/parsedresult.html +283 -0
- package/docs/interfaces/parser.html +240 -0
- package/docs/interfaces/parsingoption.html +218 -0
- package/docs/interfaces/refiner.html +218 -0
- package/docs/modules/de.html +298 -0
- package/docs/modules/en.html +361 -0
- package/docs/modules/fr.html +248 -0
- package/docs/modules/ja.html +248 -0
- package/docs/modules/nl.html +275 -0
- package/docs/modules/pt.html +248 -0
- package/package.json +1 -1
- package/src/chrono.ts +3 -1
- package/src/common/calculation/weekdays.ts +89 -0
- package/src/common/parsers/SlashDateFormatParser.ts +7 -6
- package/src/common/refiners/AbstractMergeDateTimeRefiner.ts +1 -1
- package/src/common/refiners/ForwardDateRefiner.ts +13 -0
- package/src/index.ts +10 -0
- package/src/locales/de/parsers/DEWeekdayParser.ts +2 -8
- package/src/locales/en/constants.ts +2 -1
- package/src/locales/en/parsers/ENCasualTimeParser.ts +6 -5
- package/src/locales/en/parsers/ENWeekdayParser.ts +3 -9
- package/src/locales/fr/parsers/FRWeekdayParser.ts +4 -10
- package/src/locales/nl/parsers/NLWeekdayParser.ts +3 -9
- package/src/locales/pt/parsers/PTWeekdayParser.ts +4 -10
- package/src/locales/ru/constants.ts +4 -6
- package/src/locales/ru/parsers/RUWeekdayParser.ts +3 -9
- package/src/locales/ru/refiners/RUMergeDateRangeRefiner.ts +1 -1
- package/src/locales/zh/hans/parsers/ZHHansTimeExpressionParser.ts +26 -26
- package/src/locales/zh/hant/parsers/ZHHantTimeExpressionParser.ts +26 -26
- package/src/results.ts +27 -15
- package/src/utils/dayjs.ts +12 -0
- package/test/calculation.test.ts +116 -0
- package/test/en/en.test.ts +10 -0
- package/test/en/en_casual.test.ts +7 -0
- package/test/en/en_slash.test.ts +12 -11
- package/test/en/en_time_exp.test.ts +53 -0
- package/test/en/en_weekday.test.ts +116 -1
- package/test/en/negative_cases.test.ts +11 -0
- package/test/zh/zh_hans_time_exp.test.ts +15 -0
- package/test/zh/zh_hant_time_exp.test.ts +14 -0
- package/src/calculation/weeks.ts +0 -38
|
@@ -47,9 +47,9 @@ export const FULL_MONTH_NAME_DICTIONARY: { [word: string]: number } = {
|
|
|
47
47
|
январь: 1,
|
|
48
48
|
января: 1,
|
|
49
49
|
январе: 1,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
февраль: 2,
|
|
51
|
+
февраля: 2,
|
|
52
|
+
феврале: 2,
|
|
53
53
|
март: 3,
|
|
54
54
|
марта: 3,
|
|
55
55
|
марте: 3,
|
|
@@ -125,7 +125,7 @@ export const INTEGER_WORD_DICTIONARY: { [word: string]: number } = {
|
|
|
125
125
|
семь: 7,
|
|
126
126
|
семи: 7,
|
|
127
127
|
восемь: 8,
|
|
128
|
-
|
|
128
|
+
восьми: 8,
|
|
129
129
|
девять: 9,
|
|
130
130
|
девяти: 9,
|
|
131
131
|
десять: 10,
|
|
@@ -288,8 +288,6 @@ export function parseOrdinalNumberPattern(match: string): number {
|
|
|
288
288
|
if (ORDINAL_WORD_DICTIONARY[num] !== undefined) {
|
|
289
289
|
return ORDINAL_WORD_DICTIONARY[num];
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
num = num.replace(/(?:st|nd|rd|th)$/i, "");
|
|
293
291
|
return parseInt(num);
|
|
294
292
|
}
|
|
295
293
|
|
|
@@ -3,7 +3,7 @@ import { ParsingComponents } from "../../../results";
|
|
|
3
3
|
import { REGEX_PARTS, WEEKDAY_DICTIONARY } from "../constants";
|
|
4
4
|
import { matchAnyPattern } from "../../../utils/pattern";
|
|
5
5
|
import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
|
|
6
|
-
import {
|
|
6
|
+
import { createParsingComponentsAtWeekday } from "../../../common/calculation/weekdays";
|
|
7
7
|
|
|
8
8
|
const PATTERN = new RegExp(
|
|
9
9
|
`(?:(?:,|\\(|()\\s*)?` +
|
|
@@ -31,7 +31,7 @@ export default class RUWeekdayParser extends AbstractParserWithWordBoundaryCheck
|
|
|
31
31
|
|
|
32
32
|
innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents {
|
|
33
33
|
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
|
34
|
-
const
|
|
34
|
+
const weekday = WEEKDAY_DICTIONARY[dayOfWeek];
|
|
35
35
|
const prefix = match[PREFIX_GROUP];
|
|
36
36
|
const postfix = match[POSTFIX_GROUP];
|
|
37
37
|
let modifierWord = prefix || postfix;
|
|
@@ -52,12 +52,6 @@ export default class RUWeekdayParser extends AbstractParserWithWordBoundaryCheck
|
|
|
52
52
|
modifier = "this";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
return context
|
|
57
|
-
.createParsingComponents()
|
|
58
|
-
.assign("weekday", offset)
|
|
59
|
-
.imply("day", date.date())
|
|
60
|
-
.imply("month", date.month() + 1)
|
|
61
|
-
.imply("year", date.year());
|
|
55
|
+
return createParsingComponentsAtWeekday(context.reference, weekday, modifier);
|
|
62
56
|
}
|
|
63
57
|
}
|
|
@@ -6,7 +6,7 @@ import AbstractMergeDateRangeRefiner from "../../../common/refiners/AbstractMerg
|
|
|
6
6
|
* - c 06.09.1989 [до|по] 11.12.1996
|
|
7
7
|
* - c пятницы и до среды
|
|
8
8
|
*/
|
|
9
|
-
export default class
|
|
9
|
+
export default class RUMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
|
|
10
10
|
patternBetween(): RegExp {
|
|
11
11
|
return /^\s*(и до|и по|до|по|-)\s*$/i;
|
|
12
12
|
}
|
|
@@ -76,7 +76,7 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
76
76
|
|
|
77
77
|
const refMoment = dayjs(context.refDate);
|
|
78
78
|
const result = context.createParsingResult(match.index, match[0]);
|
|
79
|
-
|
|
79
|
+
let startMoment = refMoment.clone();
|
|
80
80
|
|
|
81
81
|
// ----- Day
|
|
82
82
|
if (match[DAY_GROUP_1]) {
|
|
@@ -84,18 +84,18 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
84
84
|
if (day1 == "明") {
|
|
85
85
|
// Check not "Tomorrow" on late night
|
|
86
86
|
if (refMoment.hour() > 1) {
|
|
87
|
-
startMoment.add(1, "day");
|
|
87
|
+
startMoment = startMoment.add(1, "day");
|
|
88
88
|
}
|
|
89
89
|
} else if (day1 == "昨") {
|
|
90
|
-
startMoment.add(-1, "day");
|
|
90
|
+
startMoment = startMoment.add(-1, "day");
|
|
91
91
|
} else if (day1 == "前") {
|
|
92
|
-
startMoment.add(-2, "day");
|
|
92
|
+
startMoment = startMoment.add(-2, "day");
|
|
93
93
|
} else if (day1 == "大前") {
|
|
94
|
-
startMoment.add(-3, "day");
|
|
94
|
+
startMoment = startMoment.add(-3, "day");
|
|
95
95
|
} else if (day1 == "后") {
|
|
96
|
-
startMoment.add(2, "day");
|
|
96
|
+
startMoment = startMoment.add(2, "day");
|
|
97
97
|
} else if (day1 == "大后") {
|
|
98
|
-
startMoment.add(3, "day");
|
|
98
|
+
startMoment = startMoment.add(3, "day");
|
|
99
99
|
}
|
|
100
100
|
result.start.assign("day", startMoment.date());
|
|
101
101
|
result.start.assign("month", startMoment.month() + 1);
|
|
@@ -103,17 +103,17 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
103
103
|
} else if (match[DAY_GROUP_3]) {
|
|
104
104
|
const day3 = match[DAY_GROUP_3];
|
|
105
105
|
if (day3 == "明") {
|
|
106
|
-
startMoment.add(1, "day");
|
|
106
|
+
startMoment = startMoment.add(1, "day");
|
|
107
107
|
} else if (day3 == "昨") {
|
|
108
|
-
startMoment.add(-1, "day");
|
|
108
|
+
startMoment = startMoment.add(-1, "day");
|
|
109
109
|
} else if (day3 == "前") {
|
|
110
|
-
startMoment.add(-2, "day");
|
|
110
|
+
startMoment = startMoment.add(-2, "day");
|
|
111
111
|
} else if (day3 == "大前") {
|
|
112
|
-
startMoment.add(-3, "day");
|
|
112
|
+
startMoment = startMoment.add(-3, "day");
|
|
113
113
|
} else if (day3 == "后") {
|
|
114
|
-
startMoment.add(2, "day");
|
|
114
|
+
startMoment = startMoment.add(2, "day");
|
|
115
115
|
} else if (day3 == "大后") {
|
|
116
|
-
startMoment.add(3, "day");
|
|
116
|
+
startMoment = startMoment.add(3, "day");
|
|
117
117
|
}
|
|
118
118
|
result.start.assign("day", startMoment.date());
|
|
119
119
|
result.start.assign("month", startMoment.month() + 1);
|
|
@@ -242,7 +242,7 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
242
242
|
return result;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
let endMoment = startMoment.clone();
|
|
246
246
|
result.end = context.createParsingComponents();
|
|
247
247
|
|
|
248
248
|
// ----- Day
|
|
@@ -251,18 +251,18 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
251
251
|
if (day1 == "明") {
|
|
252
252
|
// Check not "Tomorrow" on late night
|
|
253
253
|
if (refMoment.hour() > 1) {
|
|
254
|
-
endMoment.add(1, "day");
|
|
254
|
+
endMoment = endMoment.add(1, "day");
|
|
255
255
|
}
|
|
256
256
|
} else if (day1 == "昨") {
|
|
257
|
-
endMoment.add(-1, "day");
|
|
257
|
+
endMoment = endMoment.add(-1, "day");
|
|
258
258
|
} else if (day1 == "前") {
|
|
259
|
-
endMoment.add(-2, "day");
|
|
259
|
+
endMoment = endMoment.add(-2, "day");
|
|
260
260
|
} else if (day1 == "大前") {
|
|
261
|
-
endMoment.add(-3, "day");
|
|
261
|
+
endMoment = endMoment.add(-3, "day");
|
|
262
262
|
} else if (day1 == "后") {
|
|
263
|
-
endMoment.add(2, "day");
|
|
263
|
+
endMoment = endMoment.add(2, "day");
|
|
264
264
|
} else if (day1 == "大后") {
|
|
265
|
-
endMoment.add(3, "day");
|
|
265
|
+
endMoment = endMoment.add(3, "day");
|
|
266
266
|
}
|
|
267
267
|
result.end.assign("day", endMoment.date());
|
|
268
268
|
result.end.assign("month", endMoment.month() + 1);
|
|
@@ -270,17 +270,17 @@ export default class ZHHansTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
270
270
|
} else if (match[DAY_GROUP_3]) {
|
|
271
271
|
const day3 = match[DAY_GROUP_3];
|
|
272
272
|
if (day3 == "明") {
|
|
273
|
-
endMoment.add(1, "day");
|
|
273
|
+
endMoment = endMoment.add(1, "day");
|
|
274
274
|
} else if (day3 == "昨") {
|
|
275
|
-
endMoment.add(-1, "day");
|
|
275
|
+
endMoment = endMoment.add(-1, "day");
|
|
276
276
|
} else if (day3 == "前") {
|
|
277
|
-
endMoment.add(-2, "day");
|
|
277
|
+
endMoment = endMoment.add(-2, "day");
|
|
278
278
|
} else if (day3 == "大前") {
|
|
279
|
-
endMoment.add(-3, "day");
|
|
279
|
+
endMoment = endMoment.add(-3, "day");
|
|
280
280
|
} else if (day3 == "后") {
|
|
281
|
-
endMoment.add(2, "day");
|
|
281
|
+
endMoment = endMoment.add(2, "day");
|
|
282
282
|
} else if (day3 == "大后") {
|
|
283
|
-
endMoment.add(3, "day");
|
|
283
|
+
endMoment = endMoment.add(3, "day");
|
|
284
284
|
}
|
|
285
285
|
result.end.assign("day", endMoment.date());
|
|
286
286
|
result.end.assign("month", endMoment.month() + 1);
|
|
@@ -76,7 +76,7 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
76
76
|
|
|
77
77
|
const refMoment = dayjs(context.refDate);
|
|
78
78
|
const result = context.createParsingResult(match.index, match[0]);
|
|
79
|
-
|
|
79
|
+
let startMoment = refMoment.clone();
|
|
80
80
|
|
|
81
81
|
// ----- Day
|
|
82
82
|
if (match[DAY_GROUP_1]) {
|
|
@@ -84,18 +84,18 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
84
84
|
if (day1 == "明" || day1 == "聽") {
|
|
85
85
|
// Check not "Tomorrow" on late night
|
|
86
86
|
if (refMoment.hour() > 1) {
|
|
87
|
-
startMoment.add(1, "day");
|
|
87
|
+
startMoment = startMoment.add(1, "day");
|
|
88
88
|
}
|
|
89
89
|
} else if (day1 == "昨" || day1 == "尋" || day1 == "琴") {
|
|
90
|
-
startMoment.add(-1, "day");
|
|
90
|
+
startMoment = startMoment.add(-1, "day");
|
|
91
91
|
} else if (day1 == "前") {
|
|
92
|
-
startMoment.add(-2, "day");
|
|
92
|
+
startMoment = startMoment.add(-2, "day");
|
|
93
93
|
} else if (day1 == "大前") {
|
|
94
|
-
startMoment.add(-3, "day");
|
|
94
|
+
startMoment = startMoment.add(-3, "day");
|
|
95
95
|
} else if (day1 == "後") {
|
|
96
|
-
startMoment.add(2, "day");
|
|
96
|
+
startMoment = startMoment.add(2, "day");
|
|
97
97
|
} else if (day1 == "大後") {
|
|
98
|
-
startMoment.add(3, "day");
|
|
98
|
+
startMoment = startMoment.add(3, "day");
|
|
99
99
|
}
|
|
100
100
|
result.start.assign("day", startMoment.date());
|
|
101
101
|
result.start.assign("month", startMoment.month() + 1);
|
|
@@ -103,17 +103,17 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
103
103
|
} else if (match[DAY_GROUP_3]) {
|
|
104
104
|
var day3 = match[DAY_GROUP_3];
|
|
105
105
|
if (day3 == "明" || day3 == "聽") {
|
|
106
|
-
startMoment.add(1, "day");
|
|
106
|
+
startMoment = startMoment.add(1, "day");
|
|
107
107
|
} else if (day3 == "昨" || day3 == "尋" || day3 == "琴") {
|
|
108
|
-
startMoment.add(-1, "day");
|
|
108
|
+
startMoment = startMoment.add(-1, "day");
|
|
109
109
|
} else if (day3 == "前") {
|
|
110
|
-
startMoment.add(-2, "day");
|
|
110
|
+
startMoment = startMoment.add(-2, "day");
|
|
111
111
|
} else if (day3 == "大前") {
|
|
112
|
-
startMoment.add(-3, "day");
|
|
112
|
+
startMoment = startMoment.add(-3, "day");
|
|
113
113
|
} else if (day3 == "後") {
|
|
114
|
-
startMoment.add(2, "day");
|
|
114
|
+
startMoment = startMoment.add(2, "day");
|
|
115
115
|
} else if (day3 == "大後") {
|
|
116
|
-
startMoment.add(3, "day");
|
|
116
|
+
startMoment = startMoment.add(3, "day");
|
|
117
117
|
}
|
|
118
118
|
result.start.assign("day", startMoment.date());
|
|
119
119
|
result.start.assign("month", startMoment.month() + 1);
|
|
@@ -242,7 +242,7 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
242
242
|
return result;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
let endMoment = startMoment.clone();
|
|
246
246
|
result.end = context.createParsingComponents();
|
|
247
247
|
|
|
248
248
|
// ----- Day
|
|
@@ -251,18 +251,18 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
251
251
|
if (day1 == "明" || day1 == "聽") {
|
|
252
252
|
// Check not "Tomorrow" on late night
|
|
253
253
|
if (refMoment.hour() > 1) {
|
|
254
|
-
endMoment.add(1, "day");
|
|
254
|
+
endMoment = endMoment.add(1, "day");
|
|
255
255
|
}
|
|
256
256
|
} else if (day1 == "昨" || day1 == "尋" || day1 == "琴") {
|
|
257
|
-
endMoment.add(-1, "day");
|
|
257
|
+
endMoment = endMoment.add(-1, "day");
|
|
258
258
|
} else if (day1 == "前") {
|
|
259
|
-
endMoment.add(-2, "day");
|
|
259
|
+
endMoment = endMoment.add(-2, "day");
|
|
260
260
|
} else if (day1 == "大前") {
|
|
261
|
-
endMoment.add(-3, "day");
|
|
261
|
+
endMoment = endMoment.add(-3, "day");
|
|
262
262
|
} else if (day1 == "後") {
|
|
263
|
-
endMoment.add(2, "day");
|
|
263
|
+
endMoment = endMoment.add(2, "day");
|
|
264
264
|
} else if (day1 == "大後") {
|
|
265
|
-
endMoment.add(3, "day");
|
|
265
|
+
endMoment = endMoment.add(3, "day");
|
|
266
266
|
}
|
|
267
267
|
result.end.assign("day", endMoment.date());
|
|
268
268
|
result.end.assign("month", endMoment.month() + 1);
|
|
@@ -270,17 +270,17 @@ export default class ZHHantTimeExpressionParser extends AbstractParserWithWordBo
|
|
|
270
270
|
} else if (match[DAY_GROUP_3]) {
|
|
271
271
|
var day3 = match[DAY_GROUP_3];
|
|
272
272
|
if (day3 == "明" || day3 == "聽") {
|
|
273
|
-
endMoment.add(1, "day");
|
|
273
|
+
endMoment = endMoment.add(1, "day");
|
|
274
274
|
} else if (day3 == "昨" || day3 == "尋" || day3 == "琴") {
|
|
275
|
-
endMoment.add(-1, "day");
|
|
275
|
+
endMoment = endMoment.add(-1, "day");
|
|
276
276
|
} else if (day3 == "前") {
|
|
277
|
-
endMoment.add(-2, "day");
|
|
277
|
+
endMoment = endMoment.add(-2, "day");
|
|
278
278
|
} else if (day3 == "大前") {
|
|
279
|
-
endMoment.add(-3, "day");
|
|
279
|
+
endMoment = endMoment.add(-3, "day");
|
|
280
280
|
} else if (day3 == "後") {
|
|
281
|
-
endMoment.add(2, "day");
|
|
281
|
+
endMoment = endMoment.add(2, "day");
|
|
282
282
|
} else if (day3 == "大後") {
|
|
283
|
-
endMoment.add(3, "day");
|
|
283
|
+
endMoment = endMoment.add(3, "day");
|
|
284
284
|
}
|
|
285
285
|
result.end.assign("day", endMoment.date());
|
|
286
286
|
result.end.assign("month", endMoment.month() + 1);
|
package/src/results.ts
CHANGED
|
@@ -19,6 +19,31 @@ export class ReferenceWithTimezone {
|
|
|
19
19
|
this.timezoneOffset = toTimezoneOffset(input.timezone);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a JS date (system timezone) with the { year, month, day, hour, minute, second } equal to the reference.
|
|
25
|
+
* The output's instant is NOT the reference's instant when the reference's and system's timezone are different.
|
|
26
|
+
*/
|
|
27
|
+
getDateWithAdjustedTimezone() {
|
|
28
|
+
return new Date(this.instant.getTime() + this.getSystemTimezoneAdjustmentMinute(this.instant) * 60000);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns the number minutes difference between the JS date's timezone and the reference timezone.
|
|
33
|
+
* @param date
|
|
34
|
+
* @param overrideTimezoneOffset
|
|
35
|
+
*/
|
|
36
|
+
getSystemTimezoneAdjustmentMinute(date?: Date, overrideTimezoneOffset?: number): number {
|
|
37
|
+
if (!date || date.getTime() < 0) {
|
|
38
|
+
// Javascript date timezone calculation got effect when the time epoch < 0
|
|
39
|
+
// e.g. new Date('Tue Feb 02 1300 00:00:00 GMT+0900 (JST)') => Tue Feb 02 1300 00:18:59 GMT+0918 (JST)
|
|
40
|
+
date = new Date();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const currentTimezoneOffset = -date.getTimezoneOffset();
|
|
44
|
+
const targetTimezoneOffset = overrideTimezoneOffset ?? this.timezoneOffset ?? currentTimezoneOffset;
|
|
45
|
+
return currentTimezoneOffset - targetTimezoneOffset;
|
|
46
|
+
}
|
|
22
47
|
}
|
|
23
48
|
|
|
24
49
|
export class ParsingComponents implements ParsedComponents {
|
|
@@ -141,7 +166,8 @@ export class ParsingComponents implements ParsedComponents {
|
|
|
141
166
|
|
|
142
167
|
date(): Date {
|
|
143
168
|
const date = this.dateWithoutTimezoneAdjustment();
|
|
144
|
-
|
|
169
|
+
const timezoneAdjustment = this.reference.getSystemTimezoneAdjustmentMinute(date, this.get("timezoneOffset"));
|
|
170
|
+
return new Date(date.getTime() + timezoneAdjustment * 60000);
|
|
145
171
|
}
|
|
146
172
|
|
|
147
173
|
private dateWithoutTimezoneAdjustment() {
|
|
@@ -159,20 +185,6 @@ export class ParsingComponents implements ParsedComponents {
|
|
|
159
185
|
return date;
|
|
160
186
|
}
|
|
161
187
|
|
|
162
|
-
private getSystemTimezoneAdjustmentMinute(date?: Date) {
|
|
163
|
-
if (!date || date.getTime() < 0) {
|
|
164
|
-
// Javascript date timezone calculation got effect when the time epoch < 0
|
|
165
|
-
// e.g. new Date('Tue Feb 02 1300 00:00:00 GMT+0900 (JST)') => Tue Feb 02 1300 00:18:59 GMT+0918 (JST)
|
|
166
|
-
date = new Date();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const currentTimezoneOffset = -date.getTimezoneOffset();
|
|
170
|
-
const targetTimezoneOffset =
|
|
171
|
-
this.get("timezoneOffset") ?? this.reference.timezoneOffset ?? currentTimezoneOffset;
|
|
172
|
-
|
|
173
|
-
return currentTimezoneOffset - targetTimezoneOffset;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
188
|
static createRelativeFromReference(
|
|
177
189
|
reference: ReferenceWithTimezone,
|
|
178
190
|
fragments: { [c in QUnitType]?: number }
|
package/src/utils/dayjs.ts
CHANGED
|
@@ -8,6 +8,12 @@ export function assignTheNextDay(component: ParsingComponents, targetDayJs: dayj
|
|
|
8
8
|
implySimilarTime(component, targetDayJs);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function implyTheNextDay(component: ParsingComponents, targetDayJs: dayjs.Dayjs) {
|
|
12
|
+
targetDayJs = targetDayJs.add(1, "day");
|
|
13
|
+
implySimilarDate(component, targetDayJs);
|
|
14
|
+
implySimilarTime(component, targetDayJs);
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
export function assignSimilarDate(component: ParsingComponents, targetDayJs: dayjs.Dayjs) {
|
|
12
18
|
component.assign("day", targetDayJs.date());
|
|
13
19
|
component.assign("month", targetDayJs.month() + 1);
|
|
@@ -26,6 +32,12 @@ export function assignSimilarTime(component: ParsingComponents, targetDayJs: day
|
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
export function implySimilarDate(component: ParsingComponents, targetDayJs: dayjs.Dayjs) {
|
|
36
|
+
component.imply("day", targetDayJs.date());
|
|
37
|
+
component.imply("month", targetDayJs.month() + 1);
|
|
38
|
+
component.imply("year", targetDayJs.year());
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
export function implySimilarTime(component: ParsingComponents, targetDayJs: dayjs.Dayjs) {
|
|
30
42
|
component.imply("hour", targetDayJs.hour());
|
|
31
43
|
component.imply("minute", targetDayJs.minute());
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createParsingComponentsAtWeekday, getDaysToWeekday } from "../src/common/calculation/weekdays";
|
|
2
|
+
import { Weekday } from "../src";
|
|
3
|
+
import { ReferenceWithTimezone } from "../src/results";
|
|
4
|
+
|
|
5
|
+
test("Test - This Weekday Calculation", () => {
|
|
6
|
+
{
|
|
7
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, 20 Aug 2022 12:00:00"));
|
|
8
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.MONDAY, "this");
|
|
9
|
+
expect(output.date()).toStrictEqual(new Date("Mon, Aug 22 2022 12:00:00"));
|
|
10
|
+
}
|
|
11
|
+
{
|
|
12
|
+
const reference = new ReferenceWithTimezone(new Date("Sun, 21 Aug 2022 12:00:00"));
|
|
13
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.FRIDAY, "this");
|
|
14
|
+
expect(output.date()).toStrictEqual(new Date("Fri, Aug 26 2022 12:00:00"));
|
|
15
|
+
}
|
|
16
|
+
{
|
|
17
|
+
const reference = new ReferenceWithTimezone(new Date("Tue, Aug 2 2022 12:00:00"));
|
|
18
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SUNDAY, "this");
|
|
19
|
+
expect(output.date()).toStrictEqual(new Date("Sun, Aug 7 2022 12:00:00"));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("Test - Last Weekday Calculation", () => {
|
|
24
|
+
{
|
|
25
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, 20 Aug 2022 12:00:00"));
|
|
26
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.FRIDAY, "last");
|
|
27
|
+
expect(output.date()).toStrictEqual(new Date("Fri, Aug 19 2022 12:00:00"));
|
|
28
|
+
}
|
|
29
|
+
{
|
|
30
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, 20 Aug 2022 12:00:00"));
|
|
31
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.MONDAY, "last");
|
|
32
|
+
expect(output.date()).toStrictEqual(new Date("Mon, Aug 15 2022 12:00:00"));
|
|
33
|
+
}
|
|
34
|
+
{
|
|
35
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, 20 Aug 2022 12:00:00"));
|
|
36
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SUNDAY, "last");
|
|
37
|
+
expect(output.date()).toStrictEqual(new Date("Sun, Aug 14 2022 12:00:00"));
|
|
38
|
+
}
|
|
39
|
+
{
|
|
40
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, 20 Aug 2022 12:00:00"));
|
|
41
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SATURDAY, "last");
|
|
42
|
+
expect(output.date()).toStrictEqual(new Date("Sat, Aug 13 2022 12:00:00"));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("Test - Next Weekday Calculation", () => {
|
|
47
|
+
{
|
|
48
|
+
const reference = new ReferenceWithTimezone(new Date("Sun, Aug 21 2022 12:00:00"));
|
|
49
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.MONDAY, "next");
|
|
50
|
+
expect(output.date()).toStrictEqual(new Date("Mon, Aug 22 2022 12:00:00"));
|
|
51
|
+
}
|
|
52
|
+
{
|
|
53
|
+
const reference = new ReferenceWithTimezone(new Date("Sun, Aug 21 2022 12:00:00"));
|
|
54
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SATURDAY, "next");
|
|
55
|
+
expect(output.date()).toStrictEqual(new Date("Sat, Aug 27 2022 12:00:00"));
|
|
56
|
+
}
|
|
57
|
+
{
|
|
58
|
+
const reference = new ReferenceWithTimezone(new Date("Sun, Aug 21 2022 12:00:00"));
|
|
59
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SUNDAY, "next");
|
|
60
|
+
expect(output.date()).toStrictEqual(new Date("Sun, Aug 28 2022 12:00:00"));
|
|
61
|
+
}
|
|
62
|
+
{
|
|
63
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, Aug 20 2022 12:00:00"));
|
|
64
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.FRIDAY, "next");
|
|
65
|
+
expect(output.date()).toStrictEqual(new Date("Fri, Aug 26 2022 12:00:00"));
|
|
66
|
+
}
|
|
67
|
+
{
|
|
68
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, Aug 20 2022 12:00:00"));
|
|
69
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SATURDAY, "next");
|
|
70
|
+
expect(output.date()).toStrictEqual(new Date("Sat, Aug 27 2022 12:00:00"));
|
|
71
|
+
}
|
|
72
|
+
{
|
|
73
|
+
const reference = new ReferenceWithTimezone(new Date("Sat, Aug 20 2022 12:00:00"));
|
|
74
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SUNDAY, "next");
|
|
75
|
+
expect(output.date()).toStrictEqual(new Date("Sun, Aug 28 2022 12:00:00"));
|
|
76
|
+
}
|
|
77
|
+
{
|
|
78
|
+
const reference = new ReferenceWithTimezone(new Date("Tue, Aug 2 2022 12:00:00"));
|
|
79
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.MONDAY, "next");
|
|
80
|
+
expect(output.date()).toStrictEqual(new Date("Mon, Aug 8 2022 12:00:00"));
|
|
81
|
+
}
|
|
82
|
+
{
|
|
83
|
+
const reference = new ReferenceWithTimezone(new Date("Tue, Aug 2 2022 12:00:00"));
|
|
84
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.FRIDAY, "next");
|
|
85
|
+
expect(output.date()).toStrictEqual(new Date("Fri, Aug 12 2022 12:00:00"));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
const reference = new ReferenceWithTimezone(new Date("Tue, Aug 2 2022 12:00:00"));
|
|
90
|
+
const output = createParsingComponentsAtWeekday(reference, Weekday.SUNDAY, "next");
|
|
91
|
+
expect(output.date()).toStrictEqual(new Date("Sun, Aug 14 2022 12:00:00"));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("Test - Closest Weekday Calculation", () => {
|
|
96
|
+
{
|
|
97
|
+
const refDate = new Date("Sat, 20 Aug 2022 12:00:00");
|
|
98
|
+
expect(getDaysToWeekday(refDate, Weekday.MONDAY)).toBe(2);
|
|
99
|
+
}
|
|
100
|
+
{
|
|
101
|
+
const refDate = new Date("Sat, 20 Aug 2022 12:00:00");
|
|
102
|
+
expect(getDaysToWeekday(refDate, Weekday.TUESDAY)).toBe(3);
|
|
103
|
+
}
|
|
104
|
+
{
|
|
105
|
+
const refDate = new Date("Sat, 20 Aug 2022 12:00:00");
|
|
106
|
+
expect(getDaysToWeekday(refDate, Weekday.FRIDAY)).toBe(-1);
|
|
107
|
+
}
|
|
108
|
+
{
|
|
109
|
+
const refDate = new Date("Sat, 20 Aug 2022 12:00:00");
|
|
110
|
+
expect(getDaysToWeekday(refDate, Weekday.THURSDAY)).toBe(-2);
|
|
111
|
+
}
|
|
112
|
+
{
|
|
113
|
+
const refDate = new Date("Sat, 20 Aug 2022 12:00:00");
|
|
114
|
+
expect(getDaysToWeekday(refDate, Weekday.WEDNESDAY)).toBe(-3);
|
|
115
|
+
}
|
|
116
|
+
});
|
package/test/en/en.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as chrono from "../../src";
|
|
2
2
|
import { testSingleCase, testUnexpectedResult } from "../test_util";
|
|
3
3
|
import ENTimeExpressionParser from "../../src/locales/en/parsers/ENTimeExpressionParser";
|
|
4
|
+
import { Meridiem } from "../../src";
|
|
4
5
|
|
|
5
6
|
test("Test - Date + Time Expression", function () {
|
|
6
7
|
testSingleCase(chrono, "Something happen on 2014-04-18 13:00 - 16:00 as", (result) => {
|
|
@@ -95,6 +96,15 @@ test("Test - Random text", function () {
|
|
|
95
96
|
expect(result.start.get("day")).toBe(3);
|
|
96
97
|
expect(result.start.get("month")).toBe(7);
|
|
97
98
|
});
|
|
99
|
+
|
|
100
|
+
testSingleCase(chrono, "03-27-2022, 02:00 AM", new Date(2017, 7 - 1, 7), (result) => {
|
|
101
|
+
expect(result.text).toBe("03-27-2022, 02:00 AM");
|
|
102
|
+
expect(result.start.get("day")).toBe(27);
|
|
103
|
+
expect(result.start.get("month")).toBe(3);
|
|
104
|
+
expect(result.start.get("year")).toBe(2022);
|
|
105
|
+
expect(result.start.get("hour")).toBe(2);
|
|
106
|
+
expect(result.start.get("meridiem")).toBe(Meridiem.AM);
|
|
107
|
+
});
|
|
98
108
|
});
|
|
99
109
|
|
|
100
110
|
test("Test - Wikipedia Texts", function () {
|
|
@@ -337,6 +337,13 @@ test("Test - Random text", () => {
|
|
|
337
337
|
expect(result.start.get("day")).toBe(1);
|
|
338
338
|
expect(result.start.get("hour")).toBe(15);
|
|
339
339
|
});
|
|
340
|
+
|
|
341
|
+
testSingleCase(chrono.casual, "at midnight on 12th August", new Date(2012, 8 - 1, 10, 15), (result) => {
|
|
342
|
+
expect(result.start.get("year")).toBe(2012);
|
|
343
|
+
expect(result.start.get("month")).toBe(8);
|
|
344
|
+
expect(result.start.get("day")).toBe(12);
|
|
345
|
+
expect(result.start.get("hour")).toBe(0);
|
|
346
|
+
});
|
|
340
347
|
});
|
|
341
348
|
|
|
342
349
|
test("Test - Casual time with timezone", () => {
|
package/test/en/en_slash.test.ts
CHANGED
|
@@ -168,23 +168,24 @@ test("Test - Splitter variances patterns", function () {
|
|
|
168
168
|
testWithExpectedDate(chrono, "05-25-2015", expectDate);
|
|
169
169
|
testWithExpectedDate(chrono, "05/25/2015", expectDate);
|
|
170
170
|
testWithExpectedDate(chrono, "05.25.2015", expectDate);
|
|
171
|
+
testWithExpectedDate(chrono, "/05/25/2015", expectDate);
|
|
171
172
|
|
|
172
173
|
// Also, guessing ambiguous date
|
|
173
174
|
testWithExpectedDate(chrono, "25/05/2015", expectDate);
|
|
174
175
|
});
|
|
175
176
|
|
|
176
177
|
test("Test - Impossible Dates and Unexpected Results", function () {
|
|
177
|
-
testUnexpectedResult(chrono, "8/32/2014"
|
|
178
|
-
|
|
179
|
-
testUnexpectedResult(chrono, "
|
|
180
|
-
|
|
181
|
-
testUnexpectedResult(chrono, "
|
|
182
|
-
|
|
183
|
-
testUnexpectedResult(chrono, "
|
|
184
|
-
|
|
185
|
-
testUnexpectedResult(chrono, "
|
|
186
|
-
|
|
187
|
-
testUnexpectedResult(chrono, "
|
|
178
|
+
testUnexpectedResult(chrono, "8/32/2014");
|
|
179
|
+
testUnexpectedResult(chrono, "8/32");
|
|
180
|
+
testUnexpectedResult(chrono, "2/29/2014");
|
|
181
|
+
testUnexpectedResult(chrono, "2014/22/29");
|
|
182
|
+
testUnexpectedResult(chrono, "2014/13/22");
|
|
183
|
+
testUnexpectedResult(chrono, "80-32-89-89");
|
|
184
|
+
testUnexpectedResult(chrono, "02/29/2022");
|
|
185
|
+
testUnexpectedResult(chrono, "06/31/2022");
|
|
186
|
+
testUnexpectedResult(chrono, "06/-31/2022");
|
|
187
|
+
testUnexpectedResult(chrono, "18/13/2022");
|
|
188
|
+
testUnexpectedResult(chrono, "15/28/2022");
|
|
188
189
|
});
|
|
189
190
|
|
|
190
191
|
test("Test - forward dates only option", function () {
|
|
@@ -287,3 +287,56 @@ test("Test - Parsing negative cases : 'at [some numbers] - [some numbers]' (Stri
|
|
|
287
287
|
|
|
288
288
|
testUnexpectedResult(chrono.strict, "7-730");
|
|
289
289
|
});
|
|
290
|
+
|
|
291
|
+
test("Test - forward dates only option", function () {
|
|
292
|
+
testSingleCase(
|
|
293
|
+
chrono,
|
|
294
|
+
"1am",
|
|
295
|
+
{
|
|
296
|
+
instant: new Date("Wed May 26 2022 01:57:00 GMT-0500 (CDT)"),
|
|
297
|
+
timezone: "CDT",
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
forwardDate: true,
|
|
301
|
+
},
|
|
302
|
+
(result) => {
|
|
303
|
+
expect(result.start.get("year")).toBe(2022);
|
|
304
|
+
expect(result.start.get("month")).toBe(5);
|
|
305
|
+
expect(result.start.get("day")).toBe(27);
|
|
306
|
+
expect(result.start.get("hour")).toBe(1);
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
testSingleCase(chrono, "11am", new Date(2016, 10 - 1, 1, 12), { forwardDate: true }, (result) => {
|
|
311
|
+
expect(result.start.get("year")).toBe(2016);
|
|
312
|
+
expect(result.start.get("month")).toBe(10);
|
|
313
|
+
expect(result.start.get("day")).toBe(2);
|
|
314
|
+
expect(result.start.get("hour")).toBe(11);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
testSingleCase(chrono, " 11am to 1am ", new Date(2016, 10 - 1, 1, 12), { forwardDate: true }, (result) => {
|
|
318
|
+
expect(result.start.get("year")).toBe(2016);
|
|
319
|
+
expect(result.start.get("month")).toBe(10);
|
|
320
|
+
expect(result.start.get("day")).toBe(2);
|
|
321
|
+
expect(result.start.get("hour")).toBe(11);
|
|
322
|
+
|
|
323
|
+
expect(result.end).not.toBeNull();
|
|
324
|
+
expect(result.end.get("year")).toBe(2016);
|
|
325
|
+
expect(result.end.get("month")).toBe(10);
|
|
326
|
+
expect(result.end.get("day")).toBe(3);
|
|
327
|
+
expect(result.end.get("hour")).toBe(1);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
testSingleCase(chrono, " 10am to 12pm ", new Date(2016, 10 - 1, 1, 11), { forwardDate: true }, (result) => {
|
|
331
|
+
expect(result.start.get("year")).toBe(2016);
|
|
332
|
+
expect(result.start.get("month")).toBe(10);
|
|
333
|
+
expect(result.start.get("day")).toBe(2);
|
|
334
|
+
expect(result.start.get("hour")).toBe(10);
|
|
335
|
+
|
|
336
|
+
expect(result.end).not.toBeNull();
|
|
337
|
+
expect(result.end.get("year")).toBe(2016);
|
|
338
|
+
expect(result.end.get("month")).toBe(10);
|
|
339
|
+
expect(result.end.get("day")).toBe(2);
|
|
340
|
+
expect(result.end.get("hour")).toBe(12);
|
|
341
|
+
});
|
|
342
|
+
});
|