Closed ailinvenerus closed 10 months ago
The first case is fixed in 2cbe42274d86fbb039c2fa2bf97c1186688a2546
The second case is more tricky.
strictMode
does not include month-year mentioning (see: src/locales/en/configuration.ts
). You should use the casual mode.Thank you! For the second case I don't have any other option than using the strict mode (this happens a lot in finance), is there another possible solution using strict mode?
Sorry for my slow reply.
is there another possible solution using strict mode?
For a domain-specific use case, I recommend creating a custom configuration rather than using the pre-built chrono.strict
or chronoe.casual
.
You can check src/locales/en/configuration.ts
and src/locales/en/index.ts
on what parsers/refiners are added in English and choose only the ones you want.
const configurations = {
parsers: [
new ISOFormatParser(),
new SlashDateFormatParser(littleEndian),
new ENTimeUnitWithinFormatParser(strictMode),
...
], refiners: [
new ExtractTimezoneOffsetRefiner(),
new OverlapRemovalRefiner(),
...
]
}
const customChrono = new Chrono(configurations);
Hope this helps.
Not passing when trying to parse:
'Statement of comprehensive income for the year ended Dec. 2021': It's returning undefined (not working at all)
'Statement of comprehensive income for the year ended Dec. 21' It returns 21st of December even when forcing to strictMode and littleEndian. It should be returning December 2021