UNPKG

sugar

Version:

A Javascript utility library for working with native objects.

13 lines (10 loc) 307 B
'use strict'; var _utc = require('../../common/var/_utc'); function cloneDate(d) { // Rhino environments have a bug where new Date(d) truncates // milliseconds so need to call getTime() here. var clone = new Date(d.getTime()); _utc(clone, !!_utc(d)); return clone; } module.exports = cloneDate;