|
|
|
@ -10,7 +10,7 @@ const new_dates = [
|
|
|
|
new Date('2026-04-04T03:03:03.003Z')
|
|
|
|
new Date('2026-04-04T03:03:03.003Z')
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setDate', () => {
|
|
|
|
test('date.setDate and date.setUTCDate', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,6 +18,9 @@ test('date.setDate', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getDate());
|
|
|
|
log.push(date.getDate());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -29,16 +32,28 @@ test('date.setDate', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setDate(new_dates[1].getDate()); // no change expected
|
|
|
|
date.setDate(new_dates[1].getDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [initial_date.getDate(), new_dates[0].getDate(), new_dates[1].getDate()]);
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCDate(new_dates[2].getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getDate(),
|
|
|
|
|
|
|
|
initial_date.getUTCDate(),
|
|
|
|
|
|
|
|
new_dates[0].getDate(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCDate(),
|
|
|
|
|
|
|
|
new_dates[1].getDate(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCDate(),
|
|
|
|
|
|
|
|
new_dates[2].getDate(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCDate()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setFullYear', () => {
|
|
|
|
test('date.setFullYear and date.setUTCFullYear', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,6 +61,9 @@ test('date.setFullYear', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getFullYear());
|
|
|
|
log.push(date.getFullYear());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCFullYear());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -57,20 +75,28 @@ test('date.setFullYear', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setFullYear(new_dates[1].getFullYear()); // no change expected
|
|
|
|
date.setFullYear(new_dates[1].getFullYear());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCFullYear(new_dates[2].getUTCFullYear());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getFullYear(),
|
|
|
|
initial_date.getFullYear(),
|
|
|
|
|
|
|
|
initial_date.getUTCFullYear(),
|
|
|
|
new_dates[0].getFullYear(),
|
|
|
|
new_dates[0].getFullYear(),
|
|
|
|
new_dates[1].getFullYear()
|
|
|
|
new_dates[0].getUTCFullYear(),
|
|
|
|
|
|
|
|
new_dates[1].getFullYear(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCFullYear(),
|
|
|
|
|
|
|
|
new_dates[2].getFullYear(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCFullYear()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setHours', () => {
|
|
|
|
test('date.setHours and date.setUTCHours', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -78,6 +104,9 @@ test('date.setHours', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getHours());
|
|
|
|
log.push(date.getHours());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCHours());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -89,20 +118,28 @@ test('date.setHours', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setHours(new_dates[1].getHours()); // no change expected
|
|
|
|
date.setHours(new_dates[1].getHours());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCHours(new_dates[2].getUTCHours());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getHours(),
|
|
|
|
initial_date.getHours(),
|
|
|
|
|
|
|
|
initial_date.getUTCHours(),
|
|
|
|
new_dates[0].getHours(),
|
|
|
|
new_dates[0].getHours(),
|
|
|
|
new_dates[1].getHours()
|
|
|
|
new_dates[0].getUTCHours(),
|
|
|
|
|
|
|
|
new_dates[1].getHours(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCHours(),
|
|
|
|
|
|
|
|
new_dates[2].getHours(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCHours()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setMilliseconds', () => {
|
|
|
|
test('date.setMilliseconds and date.setUTCMilliseconds', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -110,6 +147,9 @@ test('date.setMilliseconds', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getMilliseconds());
|
|
|
|
log.push(date.getMilliseconds());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMilliseconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -121,20 +161,28 @@ test('date.setMilliseconds', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setMilliseconds(new_dates[1].getMilliseconds()); // no change expected
|
|
|
|
date.setMilliseconds(new_dates[1].getMilliseconds());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMilliseconds(new_dates[2].getUTCMilliseconds());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getMilliseconds(),
|
|
|
|
initial_date.getMilliseconds(),
|
|
|
|
|
|
|
|
initial_date.getUTCMilliseconds(),
|
|
|
|
new_dates[0].getMilliseconds(),
|
|
|
|
new_dates[0].getMilliseconds(),
|
|
|
|
new_dates[1].getMilliseconds()
|
|
|
|
new_dates[0].getUTCMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[1].getMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[2].getMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCMilliseconds()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setMinutes', () => {
|
|
|
|
test('date.setMinutes and date.setUTCMinutes', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -142,6 +190,9 @@ test('date.setMinutes', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getMinutes());
|
|
|
|
log.push(date.getMinutes());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMinutes());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -153,20 +204,28 @@ test('date.setMinutes', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setMinutes(new_dates[1].getMinutes()); // no change expected
|
|
|
|
date.setMinutes(new_dates[1].getMinutes());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMinutes(new_dates[2].getUTCMinutes());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getMinutes(),
|
|
|
|
initial_date.getMinutes(),
|
|
|
|
|
|
|
|
initial_date.getUTCMinutes(),
|
|
|
|
new_dates[0].getMinutes(),
|
|
|
|
new_dates[0].getMinutes(),
|
|
|
|
new_dates[1].getMinutes()
|
|
|
|
new_dates[0].getUTCMinutes(),
|
|
|
|
|
|
|
|
new_dates[1].getMinutes(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMinutes(),
|
|
|
|
|
|
|
|
new_dates[2].getMinutes(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCMinutes()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setMonth', () => {
|
|
|
|
test('date.setMonth and date.setUTCMonth', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -174,6 +233,9 @@ test('date.setMonth', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getMonth());
|
|
|
|
log.push(date.getMonth());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMonth());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -185,20 +247,28 @@ test('date.setMonth', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setMonth(new_dates[1].getMonth()); // no change expected
|
|
|
|
date.setMonth(new_dates[1].getMonth());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMonth(new_dates[2].getUTCMonth());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getMonth(),
|
|
|
|
initial_date.getMonth(),
|
|
|
|
|
|
|
|
initial_date.getUTCMonth(),
|
|
|
|
new_dates[0].getMonth(),
|
|
|
|
new_dates[0].getMonth(),
|
|
|
|
new_dates[1].getMonth()
|
|
|
|
new_dates[0].getUTCMonth(),
|
|
|
|
|
|
|
|
new_dates[1].getMonth(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMonth(),
|
|
|
|
|
|
|
|
new_dates[2].getMonth(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCMonth()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setSeconds', () => {
|
|
|
|
test('date.setSeconds and date.setUTCSeconds', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
@ -206,6 +276,9 @@ test('date.setSeconds', () => {
|
|
|
|
render_effect(() => {
|
|
|
|
render_effect(() => {
|
|
|
|
log.push(date.getSeconds());
|
|
|
|
log.push(date.getSeconds());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCSeconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
@ -217,14 +290,22 @@ test('date.setSeconds', () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
flushSync(() => {
|
|
|
|
// nothing should happen here
|
|
|
|
date.setSeconds(new_dates[1].getSeconds()); // no change expected
|
|
|
|
date.setSeconds(new_dates[1].getSeconds());
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCSeconds(new_dates[2].getUTCSeconds());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
initial_date.getSeconds(),
|
|
|
|
initial_date.getSeconds(),
|
|
|
|
|
|
|
|
initial_date.getUTCSeconds(),
|
|
|
|
new_dates[0].getSeconds(),
|
|
|
|
new_dates[0].getSeconds(),
|
|
|
|
new_dates[1].getSeconds()
|
|
|
|
new_dates[0].getUTCSeconds(),
|
|
|
|
|
|
|
|
new_dates[1].getSeconds(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCSeconds(),
|
|
|
|
|
|
|
|
new_dates[2].getSeconds(),
|
|
|
|
|
|
|
|
new_dates[2].getUTCSeconds()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
@ -258,230 +339,6 @@ test('date.setTime', () => {
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCDate', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCDate(new_dates[0].getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCDate(new_dates[1].getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCDate(new_dates[1].getUTCDate());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCDate(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCDate(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCDate()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCFullYear', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCFullYear());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCFullYear(new_dates[0].getUTCFullYear());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCFullYear(new_dates[1].getUTCFullYear());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCFullYear(new_dates[1].getUTCFullYear());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCFullYear(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCFullYear(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCFullYear()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCHours', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCHours());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCHours(new_dates[0].getUTCHours());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCHours(new_dates[1].getUTCHours());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCHours(new_dates[1].getUTCHours());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCHours(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCHours(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCHours()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCMilliseconds', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMilliseconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMilliseconds(new_dates[0].getUTCMilliseconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMilliseconds(new_dates[1].getUTCMilliseconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCMilliseconds(new_dates[1].getUTCMilliseconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCMilliseconds(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMilliseconds()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCMinutes', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMinutes());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMinutes(new_dates[0].getUTCMinutes());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMinutes(new_dates[1].getUTCMinutes());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCMinutes(new_dates[1].getUTCMinutes());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCMinutes(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCMinutes(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMinutes()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCMonth', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCMonth());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMonth(new_dates[0].getUTCMonth());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCMonth(new_dates[1].getUTCMonth());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCMonth(new_dates[1].getUTCMonth());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCMonth(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCMonth(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCMonth()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setUTCSeconds', () => {
|
|
|
|
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
|
|
|
|
const log: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cleanup = effect_root(() => {
|
|
|
|
|
|
|
|
render_effect(() => {
|
|
|
|
|
|
|
|
log.push(date.getUTCSeconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCSeconds(new_dates[0].getUTCSeconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
date.setUTCSeconds(new_dates[1].getUTCSeconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flushSync(() => {
|
|
|
|
|
|
|
|
// nothing should happen here
|
|
|
|
|
|
|
|
date.setUTCSeconds(new_dates[1].getUTCSeconds());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(log, [
|
|
|
|
|
|
|
|
initial_date.getUTCSeconds(),
|
|
|
|
|
|
|
|
new_dates[0].getUTCSeconds(),
|
|
|
|
|
|
|
|
new_dates[1].getUTCSeconds()
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('date.setYear', () => {
|
|
|
|
test('date.setYear', () => {
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const date = new ReactiveDate(initial_date);
|
|
|
|
const log: any = [];
|
|
|
|
const log: any = [];
|
|
|
|
|