News for hackers. Stuff that matters.
Re:Date() for humans by endersshadow on Tuesday May 21, 2013 @01:29PM (#5745218)
This is really nice date detection based on semantics. The one thing I'd add is the ability to use words in lieu of numbers. For example, "in an hour" doesn't work, but "in 1 hour" does. Or, "in two months" doesn't work, but "in 2 months" does. Clearly the logic is there, but I think just adding some basic (0-99) word recognition in there would make it that much better.

And if you really want to get crazy, you could add some support for "fortnight"...if you're bored.

Re:Date() for humans by matthewmueller on Tuesday May 21, 2013 @02:09PM (#5745522)
thanks endersshadow, I'm thinking about adding stuff like that, certainly "a/an" => 1. I was also looking at doing "two" => 2, "ten" => 10, etc. I'd include it as a separate dependency if it's not too big/slow.
Re:Date() for humans by bilalq on Tuesday May 21, 2013 @01:43PM (#5745329)
This looks great. Reminds me a lot of PHP's strtotime function.
Re:Date() for humans by hal9k on Tuesday May 21, 2013 @02:18PM (#5745598)
exactly what I was going to say. I'm always impressed when strtotime correctly parses whatever crazy way to express a date that comes to mind. i.e. "tomorrow - 3 hours"
Re:Date() for humans by EliRivers on Tuesday May 21, 2013 @06:14PM (#5747304)
It doesn't seem to handle "sixteen hundred tomorrow" or any other such "x hundred" times.
Re:Date() for humans by themstheones on Tuesday May 21, 2013 @02:12PM (#5745545)
It freezes if you try to type in "fart o'clock."
Re:Date() for humans by matthewmueller on Tuesday May 21, 2013 @02:46PM (#5745850)
haha, thanks. fixed now. o'clock is ignored nonetheless (maybe that should be added though)