bootstrap-datetimepicker icon indicating copy to clipboard operation
bootstrap-datetimepicker copied to clipboard

Unparsable Date should default to today's date, not Dec. 31 1899

Open abcbaby opened this issue 7 years ago • 2 comments

Should update boostrap-datetimepicker.js parseDate().

Currently the date is set to:

date = new Date(0, 0, 0, 0, 0, 0, 0), // which is Dec. 31, 1899

change to:

date = new Date(), // which is today's date

This should resolve a bunch of current reported 1899 Year issues: https://github.com/smalot/bootstrap-datetimepicker/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%201899

abcbaby avatar Sep 26 '17 18:09 abcbaby

I agree with this. My app allows the user to switch field types on a table filter. We've seen an issue where we saw the 1899 when a stale date M dd, yyyy was present when the user loaded date time format M dd, yyyy HH:ii p.

Had to call reset as a fix, but it would have nice to have this.

Or an else statement to if (parts.length === format.parts.length) { that falls back on a new date object

mholmes-hs avatar Nov 09 '17 16:11 mholmes-hs

It would be nice if it was possible to pass the default reset date as an option for unparsable dates

adamzolotarev avatar May 24 '18 17:05 adamzolotarev