-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Relative Time now,weeks,months,years #4304
Conversation
Just while this is pending, is there any interest in adding in |
Yep go ahead! |
Went up to supporting |
Travis CI is having a capacity related issue that seems to have brought quite a few linux builds to a halt. It's locked up a PR in the php sdk as well, and anything else would probably have just about the same luck. This should be clearing up in an hour or two, but it's pending. |
Codecov Report
@@ Coverage Diff @@
## master #4304 +/- ##
==========================================
- Coverage 92.5% 92.48% -0.02%
==========================================
Files 118 118
Lines 8246 8251 +5
==========================================
+ Hits 7628 7631 +3
- Misses 618 620 +2
Continue to review full report at Codecov.
|
@marvelm are you OK with those changes? |
@@ -256,6 +256,7 @@ class ParseServer { | |||
/* eslint-disable no-console */ | |||
console.warn(`\nWARNING, Unable to connect to '${Parse.serverURL}'.` + | |||
` Cloud code and push notifications may be unavailable!\n`); | |||
/* eslint-enable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
return { | ||
status: 'success', | ||
info: 'past', | ||
result: new Date(now.valueOf() - milliseconds) | ||
}; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@montymxb Sorry for not raising this issue sooner. With this syntax, I'd expect the feature to keep the day of month constant like Moment.js. > var moment = require('moment')
> var now = '2017-11-01T11:39:45.657'
> moment(now).add(1, 'month')
moment("2017-12-01T11:39:45.657")
> moment(now).add(2, 'month')
moment("2018-01-01T11:39:45.657")
> moment(now).add(3, 'month')
moment("2018-02-01T11:39:45.657")
> moment(now).add(4, 'month')
moment("2018-03-01T11:39:45.657")
> moment(now).add(5, 'month')
moment("2018-04-01T11:39:45.657") How the feature is currently implemented: > moment(now).add(30, 'days')
moment("2017-12-01T11:39:45.657")
> moment(now).add(60, 'days')
moment("2017-12-31T11:39:45.657")
> moment(now).add(90, 'days')
moment("2018-01-30T11:39:45.657")
> moment(now).add(120, 'days')
moment("2018-03-01T11:39:45.657") I think we should tell users to specify '30 days' explicitly and remove support for |
@marvelm that sounds good to me. I'll drop |
Thanks @marvelm ! |
@flovilmart any outstanding concerns before we move this in? |
* Adds 'now' as an option in relative time * reenables no-console in previous spot * Adds weeks,months,years and abbreviations * modified tests to address coverage * month be gone!
Adds
now
as a recognized singular unit of time, indicating to use the current time as is.I figure this would be handy in cases where you would like to fetch objects from a certain # of days/weeks ago, but not past the current time, or vice versa. On it's own it may be handy as well for getting anything that is still in the future.
Also adds an
eslint-enable no-console
mark where previously it was not closed.