Open Novak-Peter opened 2 years ago
When creating a custom parser for year only, and using this with ranges (like 2019-2021), second date will always be removed by ENMergeDateTimeRefiner / AbstractMergeDateTimeRefiner - due to the following expression:
ENMergeDateTimeRefiner
AbstractMergeDateTimeRefiner
https://github.com/wanasit/chrono/blob/606c28cf18a7789746c3ebd68a75a34531090169/src/common/refiners/AbstractMergeDateTimeRefiner.ts#L14
As it turns out, isOnlyTime ignores having year only:
isOnlyTime
year
https://github.com/wanasit/chrono/blob/606c28cf18a7789746c3ebd68a75a34531090169/src/results.ts#L108-L110 I would definitely add this here: && !this.isCertain("year")
&& !this.isCertain("year")
If this is valid in your opinion, I can create a simple PR for this.
Your explanation make senses. Please feel free to submit a PR. Just make sure all current tests pass.
When creating a custom parser for year only, and using this with ranges (like 2019-2021), second date will always be removed by
ENMergeDateTimeRefiner
/AbstractMergeDateTimeRefiner
- due to the following expression:https://github.com/wanasit/chrono/blob/606c28cf18a7789746c3ebd68a75a34531090169/src/common/refiners/AbstractMergeDateTimeRefiner.ts#L14
As it turns out,
isOnlyTime
ignores havingyear
only:https://github.com/wanasit/chrono/blob/606c28cf18a7789746c3ebd68a75a34531090169/src/results.ts#L108-L110 I would definitely add this here:
&& !this.isCertain("year")
If this is valid in your opinion, I can create a simple PR for this.