3 ms·
I can kind of justify that, insofar as it's unlikely that any input would be entered directly like that and it has the quite nice property of allowing date arit
by Xophmeister 11y ago
I can kind of justify that, insofar as it's unlikely that any input would be entered directly like that and it has the quite nice property of allowing date arithmetic on an arbitrary unit (e.g., "+ 1 calendar month, 4 hours and 25 milliseconds", etc.)
- dspillett 11y agoYes, I've deliberately used it that way in the past: newDate = new Date(refDate.getFullYear(), refDate.getMonth(), refDate.getDate(), refDate.getHours()+1000, refDate.getMinutes()) letting it deal with the wrapping of larger date/time parts as needed.