%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/cwd/html/ppaobm/vendor/bower-asset/moment/src/test/moment/ |
Upload File : |
import { module, test } from '../qunit'; import moment from '../../moment'; module('now'); test('now', function (assert) { var startOfTest = new Date().valueOf(), momentNowTime = moment.now(), afterMomentCreationTime = new Date().valueOf(); assert.ok(startOfTest <= momentNowTime, 'moment now() time should be now, not in the past'); assert.ok(momentNowTime <= afterMomentCreationTime, 'moment now() time should be now, not in the future'); }); test('now - Date mocked', function (assert) { // We need to test mocking the global Date object, so disable 'Read Only' jshint check /* jshint -W020 */ var RealDate = Date, customTimeMs = moment('2015-01-01T01:30:00.000Z').valueOf(); function MockDate() { return new RealDate(customTimeMs); } MockDate.now = function () { return new MockDate().valueOf(); }; MockDate.prototype = RealDate.prototype; Date = MockDate; try { assert.equal(moment().valueOf(), customTimeMs, 'moment now() time should use the global Date object'); } finally { Date = RealDate; } }); test('now - custom value', function (assert) { var customTimeStr = '2015-01-01T01:30:00.000Z', customTime = moment(customTimeStr, moment.ISO_8601).valueOf(), oldFn = moment.now; moment.now = function () { return customTime; }; try { assert.equal(moment().toISOString(), customTimeStr, 'moment() constructor should use the function defined by moment.now, but it did not'); assert.equal(moment.utc().toISOString(), customTimeStr, 'moment() constructor should use the function defined by moment.now, but it did not'); } finally { moment.now = oldFn; } }); test('empty object, empty array', function (assert) { function assertIsNow(gen, msg) { var before = +(new Date()), mid = gen(), after = +(new Date()); assert.ok(before <= +mid && +mid <= after, 'should be now : ' + msg); } assertIsNow(function () { return moment(); }, 'moment()'); assertIsNow(function () { return moment([]); }, 'moment([])'); assertIsNow(function () { return moment({}); }, 'moment({})'); assertIsNow(function () { return moment.utc(); }, 'moment.utc()'); assertIsNow(function () { return moment.utc([]); }, 'moment.utc([])'); assertIsNow(function () { return moment.utc({}); }, 'moment.utc({})'); });