Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

same results for "ago" and "from now" #52

Open
tj opened this issue Feb 5, 2014 · 7 comments
Open

same results for "ago" and "from now" #52

tj opened this issue Feb 5, 2014 · 7 comments

Comments

@tj
Copy link

tj commented Feb 5, 2014

  console.log(date('50 minutes ago'));
  console.log(date('50 minutes from now'));

Tue Feb 04 2014 19:47:44 GMT-0800 (PST)
Tue Feb 04 2014 19:47:44 GMT-0800 (PST)

going to use this for a badass log query language :D

bulkan added a commit to bulkan/date that referenced this issue Feb 5, 2014
@bulkan
Copy link
Contributor

bulkan commented Feb 5, 2014

Interesting in node v0.10.25 using the current master branch I get

>   console.log(date('50 minutes ago'));
Wed Feb 05 2014 15:13:08 GMT+1100 (EST)

>   console.log(date('50 minutes from now'));
Wed Feb 05 2014 16:53:09 GMT+1100 (EST)

@tj
Copy link
Author

tj commented Feb 5, 2014

woah, weird, this was with 0.11.x, I'll try again tomorrow on 0.10.x

@matthewmueller
Copy link
Owner

@visionmedia sweet! let me know how it works out for you. it's definitely a bit rough around the edges (esp with month queries) but i'm planning on picking it back up again soon.

@bulkan
Copy link
Contributor

bulkan commented Feb 5, 2014

Hey @matthewmueller let me know if you need help :)

@matthewmueller
Copy link
Owner

seems to work okay for me. i tried 10.22 & 11.11:

console.log(date('50 minutes ago'))
console.log(date('50 minutes from now'))

Wed Feb 05 2014 11:52:51 GMT+0100 (CET)
Wed Feb 05 2014 13:32:55 GMT+0100 (CET)

@visionmedia also, one thing to keep in mind is that this parser prefers future dates (was made for scheduling). so if you type ambiguous phrases like '50 minutes', it'll assume '50 minutes from now'. that might not be ideal for logging. definitely down to explore ways to make it more general though.

@matthewmueller
Copy link
Owner

@bulkan awesome! the 3 big things are:

  1. getting english numbers working (in thirty minutes)
  2. getting months working (march 5th, january sixth, 12th of march)
  3. and "this thursday" is not the same as "next thursday" #2

@bulkan
Copy link
Contributor

bulkan commented Feb 6, 2014

1. sounds interesting. I shall work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants