FIX: recurring was not working for some cases (eg: hours and unit > 1) (#11657)

This commit is contained in:
Joffrey JAFFEUX
2021-01-07 12:21:51 +01:00
committed by GitHub
parent 0c451d14d9
commit 49f4c75080
4 changed files with 37 additions and 15 deletions

View File

@ -28,7 +28,7 @@ test("#format", function (assert) {
assert.equal(date.format(), "2020-03-15T15:36:00.000+01:00");
});
test("#repetitionsBetweenDates", function (assert) {
test("#unitRepetitionsBetweenDates", function (assert) {
let date;
date = buildDateHelper({
@ -39,7 +39,7 @@ test("#repetitionsBetweenDates", function (assert) {
timezone: PARIS,
});
assert.equal(
date.repetitionsBetweenDates(
date.unitRepetitionsBetweenDates(
"1.hour",
moment.tz("2020-02-15 15:36", SYDNEY)
),
@ -55,7 +55,7 @@ test("#repetitionsBetweenDates", function (assert) {
timezone: PARIS,
});
assert.equal(
date.repetitionsBetweenDates(
date.unitRepetitionsBetweenDates(
"1.minute",
moment.tz("2020-02-15 15:36", PARIS)
),
@ -71,7 +71,7 @@ test("#repetitionsBetweenDates", function (assert) {
timezone: PARIS,
});
assert.equal(
date.repetitionsBetweenDates(
date.unitRepetitionsBetweenDates(
"1.minute",
moment.tz("2020-02-15 15:37", PARIS)
),
@ -87,11 +87,11 @@ test("#repetitionsBetweenDates", function (assert) {
timezone: PARIS,
});
assert.equal(
date.repetitionsBetweenDates(
"2.minute",
date.unitRepetitionsBetweenDates(
"2.minutes",
moment.tz("2020-02-15 15:41", PARIS)
),
2.5,
6,
"it correctly finds difference with a multiplicator"
);
});

View File

@ -233,6 +233,21 @@ test("option[recurring]", function (assert) {
"it works for a future date"
);
});
freezeTime({ date: "2021-01-08 11:16" }, () => {
assert.buildsCorrectDate(
{
date: "2021-01-05",
time: "14:00",
recurring: "2.hours",
timezone: NEW_YORK,
},
{
formated: "Today 12:00 PM",
},
"it works with hours"
);
});
});
test("option[countown]", function (assert) {