Comments (5)
This is likely a timezone issue. I'm betting that moment.utc("01/01/2014").recur().... will do what you need. You can also do moment.recur("01/01/2014").... which sets the start date.
from moment-recur.
@bholbrook73 Both suggestions yield the same result as I reported in the original post.
from moment-recur.
Seems to work as expected here: https://jsfiddle.net/gg9gtm0c/
If you are still around and have any more information regarding the issue (actual source code would help), please let me know. Thanks.
from moment-recur.
As bholbrook73 suggested this is locale issue, but this is a bug in moment-recur
because moment-recur use moment.dateOnly() which is not documented (deprecated?) and not locale aware
I suggest lib should use moment.startOf('day')
moment("01/02/2017","MM/DD/YYYY").utcOffset(120,true).toString()
"Mon Jan 02 2017 00:00:00 GMT+0200"
moment("01/02/2017","MM/DD/YYYY").utcOffset(120,true).recur().every(1).daysOfWeek().next(1)[0].toString()
"Mon Jan 02 2017 22:00:00 GMT+0000"
moment("01/02/2017","MM/DD/YYYY").utcOffset(0,true).toString()
"Mon Jan 02 2017 00:00:00 GMT+0000"
moment("01/02/2017","MM/DD/YYYY").utcOffset(0,true).recur().every(1).daysOfWeek().next(1)[0].toString()
"Mon Jan 09 2017 00:00:00 GMT+0000"
from moment-recur.
It should be nice to add a note to document to tell users that moment-recur will return moment objects in UTC mode.
from moment-recur.
Related Issues (20)
- Falsely matching recurring days HOT 1
- Non-ISO format used in NPM download HOT 2
- Every 2nd friday? HOT 1
- New format 'YYYY-MM-DDT00:00:00.000Z' is wrong
- use with angular 2 HOT 6
- Exceptions HOT 3
- npm release? HOT 3
- startDate value is different if "moment-timezone" is present HOT 2
- Not possible to set duplicate intervals on .every()
- No longer maintained? Please add collaborators/maintainers HOT 2
- Match function returning bad result
- Match between 2 dates HOT 1
- Using yarn instead of npm occurs error in importing module HOT 3
- recurrence.next(1) hangs HOT 9
- Issue when fetching date for every 2 weeks HOT 1
- .all() recurrences are wrong if startDate is 31st day of month HOT 2
- Recur every 2 weeks on Mon and Tues
- Filter HOT 1
- Is this date offset a bug?
- .matches returns incorrectly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moment-recur.