Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit ae7189d

Browse files
committed
Fix js dateValueOf function
1 parent 00857ba commit ae7189d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/customize-snapshots.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -774,16 +774,18 @@
774774
/**
775775
* Get the primitive value of a Date object.
776776
*
777-
* @param {string} dateString The post status for the snapshot.
777+
* @param {string|Date} dateString The post status for the snapshot.
778778
* @returns {object|string} The primitive value or date object.
779779
*/
780780
component.dateValueOf = function( dateString ) {
781781
var date;
782782

783-
if ( _.isUndefined( dateString ) ) {
784-
date = new Date();
785-
} else {
783+
if ( 'string' === typeof dateString ) {
786784
date = new Date( dateString );
785+
} else if ( dateString instanceof Date ) {
786+
date = dateString;
787+
} else {
788+
date = new Date();
787789
}
788790

789791
return date.valueOf();

0 commit comments

Comments
 (0)