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

humanize.naturalDay() doesn't apear to return today, yesterday as apropriate #22

Open
chevalierc opened this issue Jul 8, 2016 · 1 comment

Comments

@chevalierc
Copy link

`humanize = require("humanize")

console.log( humanize.naturalDay(new Date(),"m-d-Y" ) )

// returns "07-08-2016"`

Doesn't work on my application or tonicDec/npm

@jraez
Copy link

jraez commented Oct 31, 2017

I hit the same issue and figure it how. You need to pass a unix timestamp, not a date object.
something like:

console.log( humanize.naturalDay(new Date().getTime() / 1000,"m-d-Y" ) )

If you use moment.js you can just do:

console.log( humanize.naturalDay(moment().unix(),"m-d-Y" ) )

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

2 participants