chronotope / chrono

Date and time library for Rust
Other
3.33k stars 533 forks source link

User-friendly date/time parsing #129

Open jonas-schievink opened 7 years ago

jonas-schievink commented 7 years ago

It would be nice if chrono (or another crate, really) offered more ways of parsing date and time strings that come from user input. These strings often don't fully specify a DateTime, so I'd like to use the current date as a sort of "fallback" (imagine that the user wants to set a timer to fire today at 12:30, so they just enter "12:30" and expect it to work).

Currently, chrono just bails when a parsed string doesn't fully specify a DateTime.

lifthrasiir commented 7 years ago

This sounds like a strtotime-esque niche crate! I think it's useful to have but not a scope of the main crate. Probably it's in the scope of the Chronotope organization however.

beamspease commented 7 years ago

I too would like to see this, but I keep jumping around too much to learn nom well enough to do something about it.

blankname commented 7 years ago

Sounds like something that would fit well in the humantime crate (it currently only supports parsing durations). https://github.com/tailhook/humantime

0xpr03 commented 7 years ago

This would be really useful. I've some tasks to start daily from a certain time. Currently I've much boilerplate code which breaks with every chrono release just to parse a user %H:%M which is added to the current date and then checked whether we've to wait for tomorrow or can schedule this already today.