hijonathan / moment.twitter

A Twitter-like date formatter for moment.js
MIT License
104 stars 39 forks source link

Use .twitter() over a moment.js duration #7

Open decklord opened 10 years ago

decklord commented 10 years ago

It would be awesome that the following code would work:

moment.duration(secondsInterval, 's').twitter()

I just have a seconds interval.

hijonathan commented 10 years ago

Great idea! Would you be interested in sending a PR? If not, I can try to get to it in the next couple of weekends.

In the meantime, a workaround would be to simply do something like this:

moment().subtract(secondsInterval, 's').twitter()
hijonathan commented 10 years ago

On second thought, doing it that way is probably a more elegant solution. What do you think?