Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

letting native date construct date #923

Conversation

swilliamset
Copy link
Contributor

instead of moment falling back to native date
bypasses deprecated warning
fix #915

instead of moment falling back to native date
bypasses deprecated warning
fix #915
// moment shows deprecated warning if sent poorly formated string
// building via "new Date" first
// still possible unpredictable results if the string is kindof well formated
d = moment( new Date(d) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure just sending the string through new Date here is a good idea. Newing up Date objects can throw exceptions if the string if not formatted correctly, which is handled down lower on line 371. This should probably either be safer, or this entire chunk of code re-written to consolidate some of the error handling code pieces.

Dave Woodward and others added 2 commits December 15, 2014 16:48
@interactivellama
Copy link
Contributor

Bookmarking this moment.js issue before I merge: Be careful when falling back to Date constructor

tl;dr version:
Dev's just want date parsing to magically happen, but moment only take ISO now unless you provide a format. Use of native browser Date() has been removed for parsing due to differences between browsers. Now moment fires an error if it's not getting ISO format. Although as you can see, we are using Date() to parse before we pass to moment unless a format is provided.

interactivellama added a commit that referenced this pull request Dec 31, 2014
…ing-#915

letting native date construct date. Fixes #915
@interactivellama interactivellama merged commit e673c44 into ExactTarget:master Dec 31, 2014
@swilliamset swilliamset deleted the clear-moment-deprecated-warning-#915 branch January 2, 2015 18:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

moment.js deprecation warning causes travis to fail on datepicker tests
4 participants