Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Durat.io (durat.io)
119 points by strictfp on July 13, 2015 | hide | past | favorite | 39 comments



You could bring this to a wider audience by integrating it with DuckDuckGo. You can arrange for DDG to send appropriate queries to your service with Spice [0].

If you don't want to handle the traffic, you can program an instant answer that runs on the DDG servers. Right now they have separate modules for time zone conversion [1], unit conversion [2] and uptime calculation [3]. Durat.io appears to hit a much wider set of use cases.

[0] https://duck.co/duckduckhack/spice_overview [1] https://duck.co/ia/view/timezone_converter [2] https://duck.co/ia/view/conversions [3] https://duck.co/ia/view/uptime


This is a great idea! Thanks!


Author here. I built this primarily to perform time-sheet calculations and to figure out what time it is in different cities easily when talking to friends overseas.

The site is the culmination of my experimentation with parsers, and specifically my last little Java TDOP parser library bychan (https://github.com/atorstling/bychan).

Please criticize / ask any questions and/or suggest anything below.


Looks OK.

Now looking at the examples, the answer for "now in zone Lisbon" gives

2015-07-13T13:31:47.968+01:00[Europe/Lisbon]

Why not just "today, 14:31:47, Lisbon"? If I enter the expression I don't actually like receiving the expression as the answer. Also, the whole "expression" of the translation of the question is displayed, when most probably the user doesn't need it every time, and then it's initially confusing.


https://xkcd.com/1179/

BTW: what does "today" mean when your wall clock shows e.g. 23:25:00? Is it "today in Lisbon" or "today at your timezone"?


Duratio actually kinda adresses this for time instants. If you enter "now" you get an instant. You can move it around the time axis and show its value at a specific zone by using "in zone PST" or similar. So if you enter "now PST" the timezone is considered redundant information and you get an error. But if you say "2013-01-10 PST" it parses. The conversion can be performed by entering "2013-01-10 pst in zone cet".

"today" and similar expressions are calculated in CET. I was considering customizing this or adding syntax for it, but it was de-scoped for the initial release.


I agree, it can be confusing too. At least as long as the "today" is the same on both places, it's clear. I'd keep the full date when it's not today on both places.

And do you prefer the current:

2015-07-13T13:31:47.968+01:00[Europe/Lisbon]

or something simpler?


Yet, the mouse over text for the comic says "ISO 8601 was published on 06/05/88 and most recently amended on 12/01/04."

Is this irony?

Probably not. Nothing is ever irony.


Thanks for your feedback. I agree that the representation is suboptimal. I will work on this if there is interest in the site. Regarding the ast representation, I will think about making it optional.


Reminds me a little of Date::Manip, the crazy Perl date library that would actually accept strings like:

"2 weeks ago on Friday at 13:45"

"Saturday Christmas 2010 at noon"

http://search.cpan.org/~sbeck/Date-Manip-6.50/lib/Date/Manip...


Nice work. Looks like a useful tool, especially since time calculations can be confusing.

Remember to sanitize your input. http://durat.io/?q=%22/%3E%3Cscript%3Ealert(1);%3C/script%3E


Poor little Bobby Tables can't register :D Thanks


Looks pretty good. Some nits:

The query "9999-99-99" throws java.time.format.DateTimeParseException (http://durat.io/?q=9999-99-99).

The query "2147483647 days + 1 day" throws java.lang.ArithmeticException (http://durat.io/?q=2147483647+days+%2B+1+day)

The query "1752-09-14 - 1752-09-02" returns PT288H, but arguably it should return PT24H (http://durat.io/?q=1752-09-14+-+1752-09-02, see also: https://en.wikipedia.org/wiki/Cal_(Unix)#Features)


Thanks for the QA! I haven't put all to much time into weeding out all the bugs yet. If the site gets popular that will definitely change.

edit: The first bug is a showstopper. Everything is supposed to be a bigint, so this will be fixed ASAP. The second one I will catch and print a nicer error for. The third one I will have to look into. I probably perform the calculation incorrectly by using the wrong temporal types. Thanks again.


The third one is the hardest to deal with:

  ~$ cal 9 1752
     September 1752     
  Su Mo Tu We Th Fr Sa  
         1  2 14 15 16  
  17 18 19 20 21 22 23  
  24 25 26 27 28 29 30  
This isn't the only bit of craziness you'd need to deal with if you wanted to handle historical times perfectly. For instance, consider attempting to get an accurate duration in hours of a time that extends across the daylight savings time switchover, historically, in a region where that has changed from year to year.

Another interesting one: 2015-07-01 - 2015-06-29 returns "PT48H", but it should be 48 hours and 1 second.


I'm currently passing on all the date calculations to the java.time API, so at least I won't have to do it all on my own. But it's sometimes a challenge to even pass it down the right way will all the different use-cases and temporal types available.



Yes, will be fixed.


Can it do anything wolframalpha.com can't?


Well, I'm not sure. I aimed at getting better than google calculator. But hopefully durat.io is quicker. Any requests are welcome!

edit: After doing some quick testing, Wolfram doesn't seem very good at time zone conversions or time span conversions.


I came here to say this. I use WA for all my time calculations.


My first try was "today + 6 weeks". Got "Lexing failed". My second try was "now + 2 hours in new york". Got "Lexing failed".

I suppose, I doesn't understand my accent ;)


If you're *nix user, you can quite easily perform this kind of stuff using date, or at least using date from coreutils.

    $ date -d 'today + 6 weeks'
    Mon Aug 24 13:15:54 CEST 2015
    
    $ TZ=America/New_York date -d 'now + 2 hours'
    Mon Jul 13 09:16:17 EDT 2015


I had no idea. Great tip, thanks!


My NLP is not top notch :D. I figured that getting the parsing intuitive would be doable given the relatively narrow field, but I was proven wrong :) The result is that you need to learn the syntax a bit before it feels intuitive.

Regarding your specific examples: You need "in _zone_ new york" ATM. I think 'weeks' is missing simply as the result of an oversight :/ Thanks for the QA.


I've been using Soulver on mac which does a lot of similar unit calculations, conversions etc. Works with time (but maybe not as advanced) and a lot of other things.


Ever heard about rebol?

>> now

== 13-Jul-2015/11:46:45+3:00

>> now + 4:15

== 13-Jul-2015/16:01:52+3:00


PostgreSQL also does time calculations spectacularly well.


Yep, but my key point here is the syntax baked into the language itself.


nope, but thanks for the information. Please check out the time zone conversions as well.


oops, i borked it: http://durat.io/?q=0%2F0


Nicely done! At least you didn't try to paste half of wikipedia into the input field as my nice collegue did :)


Haha, nice, good to see my old domain put to a better use :))


What a coincidence! I spent a _lot_ of time trying to find some time-related domain name which wasn't taken. What were you using it for?


Does PT stands for present time?

> 8:30am + 2.5 hours = PT11H


Nope, it's https://en.wikipedia.org/wiki/ISO_8601 for 11 hours. Try "8:30 am today + 2.5 hours".


Neat.


Great job! Well done.





Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: