%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 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/thread-self/root/var/www/html/ppaobm/vendor/bower-asset/moment/src/test/moment/ |
Upload File : |
// These tests are for locale independent features
// locale dependent tests would be in locale test folder
import { module, test } from '../qunit';
import moment from '../../moment';
module('calendar');
test('passing a function', function (assert) {
var a = moment().hours(13).minutes(0).seconds(0);
assert.equal(moment(a).calendar(null, {
'sameDay': function () {
return 'h:mmA';
}
}), '1:00PM', 'should equate');
});
test('extending calendar options', function (assert) {
var calendarFormat = moment.calendarFormat;
moment.calendarFormat = function (myMoment, now) {
var diff = myMoment.diff(now, 'days', true);
var nextMonth = now.clone().add(1, 'month');
var retVal = diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' :
(myMoment.month() === now.month() && myMoment.year() === now.year()) ? 'thisMonth' :
(nextMonth.month() === myMoment.month() && nextMonth.year() === myMoment.year()) ? 'nextMonth' : 'sameElse';
return retVal;
};
moment.updateLocale('en', {
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
thisMonth : '[This month on the] Do',
nextMonth : '[Next month on the] Do',
sameElse : 'L'
}
});
var a = moment('2016-01-01').add(28, 'days');
var b = moment('2016-01-01').add(1, 'month');
try {
assert.equal(a.calendar('2016-01-01'), 'This month on the 29th', 'Ad hoc calendar format for this month');
assert.equal(b.calendar('2016-01-01'), 'Next month on the 1st', 'Ad hoc calendar format for next month');
assert.equal(a.locale('fr').calendar('2016-01-01'), a.locale('fr').format('L'), 'French falls back to default because thisMonth is not defined in that locale');
} finally {
moment.calendarFormat = calendarFormat;
moment.updateLocale('en', null);
}
});