chrono icon indicating copy to clipboard operation
chrono copied to clipboard

User-friendly date/time parsing

Open jonas-schievink opened this issue 8 years ago • 4 comments

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.

jonas-schievink avatar Feb 12 '17 19:02 jonas-schievink

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.

lifthrasiir avatar Feb 13 '17 05:02 lifthrasiir

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

beamspease avatar Apr 13 '17 05:04 beamspease

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

blankname avatar Jun 05 '17 02:06 blankname

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.

0xpr03 avatar Aug 25 '17 18:08 0xpr03