Closed johnjansen closed 3 years ago
@johnjansen Will start working on it today.
timer
seems not like an optimal choice for naming a shard that's supposed to parse date-time data.
And please note that if you wan't this to be in any way useful, you should avoid introducing a custom Timer::Time
class but use the stdlib's Time
instead. I'm sure it can do everything you need and users should not have to convert between different date-time types.
@straight-shoota the plan was to do something unlike StdLib, and more like Chronic (Ruby) which is a pure Ruby natural language date parser.
stuff more like the following
Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006
however i agree that timer
is a bad name choice ;-)
@straight-shoota @johnjansen Any name suggestions?
@johnjansen yeah, sure. But it shouldn't need its own implementation of a date-time data type. These parsing methods can just be built upon the stdlib Time type.
totally agreed @straight-shoota, i haven't actually looked at the code (ok so there aint much to see yet), too much on my plate right now
For name, why not TimeParser? It's clear and straightforward.
or Parsley, why ... no reason at all ;)
Will choose one after I slept a few hours. I really apperciate this conversation.
Just please don't call it chronic.cr. The drug connotations of the word chronic would make it hard for me to use the library without laughing.
@HCLarsen CrackTime ???
Decided to leave crystal so I won't develop the library any further and delete it. Sorry.
Crystal will miss you. She is always here for you. And she will be waiting for you to realize what you have lost. But remember to apologize to her when you come to your senses. ;-)
I have a partial implementation of php's strtotime
, which for some users might be enough.
https://github.com/iomcr/php-strtotime
If a specific format is not supported in my library, but exists in php's strtotime, then it might have a draft definition here: https://github.com/iomcr/php-strtotime/blob/master/src/Strtotime/format_parsers.cr which likely just needs someone familiar with the format to add a spec file for it and finish converting it from JS.
It seems that @nanobowers migrated cronic:
https://github.com/nanobowers/cronic
So I guess this can be closed now? :thinking:
just like chronic for ruby https://github.com/mojombo/chronic