FIX: ensures recurring works when setting a start date in future (#11587)

This commit is contained in:
Joffrey JAFFEUX 2020-12-29 20:11:18 +01:00 committed by GitHub
parent 09f9d4b281
commit 8af6e72675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -47,7 +47,7 @@ export default class LocalDateBuilder {
localTimezone: this.localTimezone,
});
if (this.recurring) {
if (this.recurring && moment().isAfter(localDate.datetime)) {
const [count, type] = this.recurring.split(".");
const repetitionsForType = localDate.repetitionsBetweenDates(

View File

@ -5,6 +5,7 @@ import sinon from "sinon";
const UTC = "Etc/UTC";
const SYDNEY = "Australia/Sydney";
const LOS_ANGELES = "America/Los_Angeles";
const NEW_YORK = "America/New_York";
const PARIS = "Europe/Paris";
const LAGOS = "Africa/Lagos";
const LONDON = "Europe/London";
@ -217,6 +218,21 @@ test("option[recurring]", function (assert) {
"it works to the minute"
);
});
freezeTime({ date: "2020-12-28 09:16" }, () => {
assert.buildsCorrectDate(
{
date: "2021-01-24",
time: "08:30",
recurring: "1.weeks",
timezone: NEW_YORK,
},
{
formated: "January 24, 2021 2:30 PM",
},
"it works for a future date"
);
});
});
test("option[countown]", function (assert) {