I found this crate while looking for convenient human date(time) parser.
I wanted to use this for filtering in a time range from..to.
The thing that's crucial for that is deciding the granularity the user is working at.
Say I want to find everything from 2023, meaning I want everything from 2023.01.01 to 2023.12.31.
If we assume there is time involved, this becomes much more apparent.
Find everything from jan -> from 2024.01.01 00:00:00.000 to 2024.01.31 23:59:59.999
Same for jan 1 -> from 2024.01.01 (00:00:00.000) to 2024.01.01 (23:59:59.999)
With that said, what I'd like to access is the highest unit type used in the date: year, month, day (, hour, minute, second)
So that I can appropriately fill in all the fields below that granularity, with minimal or maximum values depending on the boundary it's for.
I found this crate while looking for convenient human date(time) parser. I wanted to use this for filtering in a time range
from..to
.The thing that's crucial for that is deciding the granularity the user is working at. Say I want to find everything from
2023
, meaning I want everything from2023.01.01
to2023.12.31
.If we assume there is time involved, this becomes much more apparent. Find everything from
jan
-> from2024.01.01 00:00:00.000
to2024.01.31 23:59:59.999
Same forjan 1
-> from2024.01.01 (00:00:00.000)
to2024.01.01 (23:59:59.999)
With that said, what I'd like to access is the highest unit type used in the date: year, month, day (, hour, minute, second) So that I can appropriately fill in all the fields below that granularity, with minimal or maximum values depending on the boundary it's for.