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
Add fromNow
#100
Comments
I like the idea of that. I'll take a crack at it now. Wouldn't want to mess with existing implementations that rely on exporting a function instead of an ms object with methods, though. Maybe the call would look something more like
|
+1 on the idea. And I totally agree with @mikemfleming, a |
|
I think I'm done. I'll write some tests and open a PR later today. |
Opened PR #101, please review and let me know what you think. |
Awesome! I just checked it out locally with just the 2h example from above and it worked perfectly. Nice. |
I'm having trouble seeing the gain in going from:
to:
What about making the above equivalent to this instead?:
|
@jeteon you gain readability. |
But isn't |
@TooTallNate take a look at my PR. I think we all agree that a |
What are the other use cases? |
In retrospect I agree the gain is rather small. I don't think this is a good idea anymore. I might make a ms wrapper package should I still be in need of something alike. |
I guess having a utility function like this would fix your use case? function msAfter(duration) {
return Date.now() + ms(duration);
} |
We're going to pass on this feature request for now. Using idiomatic JavaScript (that is, |
This is a very common pattern in my code. Not sure about how other people use it.
I'd love to add
fromNow
as shortcut.Yay or nay?
The text was updated successfully, but these errors were encountered: