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

Commit

Permalink
letting native date construct date
Browse files Browse the repository at this point in the history
instead of moment falling back to native date
bypasses deprecated warning
fix #915
  • Loading branch information
swilliams committed Dec 9, 2014
1 parent 5f52a16 commit 6d151e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,16 @@
if(date){
if(this.moment){ //if we have moment, use that to parse the dates
momentParse = function(type, d){
d = (type==='b') ? moment(d, self.momentFormat) : moment(d);
if(type==='b') {
d = moment(d, self.momentFormat);
}
else {
// 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) );
}

return (d.isValid()===true) ? d.toDate() : new Date(NaN);
};
use = (typeof(date)==='string') ? ['b', 'a'] : ['a', 'b'];
Expand Down

0 comments on commit 6d151e5

Please sign in to comment.