mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: ensures recurring works when setting a start date in future (#11587)
This commit is contained in:
parent
09f9d4b281
commit
8af6e72675
@ -47,7 +47,7 @@ export default class LocalDateBuilder {
|
|||||||
localTimezone: this.localTimezone,
|
localTimezone: this.localTimezone,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.recurring) {
|
if (this.recurring && moment().isAfter(localDate.datetime)) {
|
||||||
const [count, type] = this.recurring.split(".");
|
const [count, type] = this.recurring.split(".");
|
||||||
|
|
||||||
const repetitionsForType = localDate.repetitionsBetweenDates(
|
const repetitionsForType = localDate.repetitionsBetweenDates(
|
||||||
|
@ -5,6 +5,7 @@ import sinon from "sinon";
|
|||||||
const UTC = "Etc/UTC";
|
const UTC = "Etc/UTC";
|
||||||
const SYDNEY = "Australia/Sydney";
|
const SYDNEY = "Australia/Sydney";
|
||||||
const LOS_ANGELES = "America/Los_Angeles";
|
const LOS_ANGELES = "America/Los_Angeles";
|
||||||
|
const NEW_YORK = "America/New_York";
|
||||||
const PARIS = "Europe/Paris";
|
const PARIS = "Europe/Paris";
|
||||||
const LAGOS = "Africa/Lagos";
|
const LAGOS = "Africa/Lagos";
|
||||||
const LONDON = "Europe/London";
|
const LONDON = "Europe/London";
|
||||||
@ -217,6 +218,21 @@ test("option[recurring]", function (assert) {
|
|||||||
"it works to the minute"
|
"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) {
|
test("option[countown]", function (assert) {
|
||||||
|
Loading…
Reference in New Issue
Block a user