GrayJack / coreutils

Core utils re-implementation for UNIX/UNIX-like systems written in Rust
Mozilla Public License 2.0
108 stars 40 forks source link

Date: Implement correct parsing of input date #87

Closed kegesch closed 5 years ago

kegesch commented 5 years ago

With a given input date the current implementation uses chrono's strftime to parse the date. Unfortunately it can not parse a date if it turns out that it is not unique (e.g. parsing "2018" with "%Y"). The parsing should be improved such that if a datetime is not unique the missing values should filled with the ones of the current time (e.g: parsing "2018" with "%Y" should result in "01-01-2018 20:00:00" if now is 01-01-2019 20:00:00).

GrayJack commented 5 years ago

Checkout this crate: https://docs.rs/time/0.1.42/time/index.html

kegesch commented 5 years ago

@GrayJack uuh nice. Seems like the strptime function could work. See this play-rust. I will investigate it further later.