question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

moment deprecation warning possibly originating from moment-recur

See original GitHub issue

I’m not 100% sure, but, I believe this line (moment-recur.js:737):

return moment.tz(this.format('YYYY-MM-DD'), 'UTC');

Is causing this warning:

Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

I think you want to do this:

return moment.tz(this.format('YYYY-MM-DDT00:00:00.000Z'), 'UTC');

or

return moment.tz(this.format('YYYY-MM-DD'), 'YYYY-MM-DD');

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
niftylettucecommented, Jun 13, 2017

I submitted a PR - if someone wants to avoid this issue until PR is accepted, npm install --save niftylettuce/moment-recur.

0reactions
c-trimmcommented, Jun 17, 2017

@niftylettuce done. Thanks for the contribution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

“Deprecation warning: moment construction falls back to js ...
When constructing a moment object with date not in these formats, the deprecation warning is thrown. Though the deprecation warnings are thrown, for...
Read more >
Be careful when falling back to Date constructor · Issue #1407
Deprecation warning : moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release.
Read more >
Deprecation warning: moment construction falls back to js Date.
I was looking on the site for some pointers, but can;t seem to find any reference to this library any more. ->getFormatter( 'Format::datetime', ......
Read more >
Guides - Moment.js
There are several places where Moment.js displays deprecation warnings about functionality that will be removed in the future. Work-arounds are outlined here.
Read more >
Moment.js documentation - DevDocs
Note: In 2.4.0, the globally exported moment object was deprecated. ... specify noGlobal then the globally exported moment will print a deprecation warning....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found