add monthly as day increment option
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@ -50,6 +50,7 @@ export function addRepetitonStringToEventDescription(oldguildScheduledEvent: str
|
||||
export function getNewScheduledStart(oldguildScheduledEvent: GuildScheduledEvent<"SCHEDULED" | "ACTIVE" | "COMPLETED" | "CANCELED">, rInfo: RepetitonInfo): DateResolvable {
|
||||
const oldDate = oldguildScheduledEvent.scheduledStartAt
|
||||
let daysToAdd = 0
|
||||
let monthsToAdd = 0
|
||||
switch (rInfo.schedule) {
|
||||
case 'daily':
|
||||
daysToAdd = 1
|
||||
@ -57,11 +58,15 @@ export function getNewScheduledStart(oldguildScheduledEvent: GuildScheduledEvent
|
||||
case 'weekly':
|
||||
daysToAdd = 7
|
||||
break
|
||||
case 'monthly':
|
||||
monthsToAdd = 1
|
||||
break
|
||||
default:
|
||||
throw new Error('No schedule found, cant add days')
|
||||
}
|
||||
const duration: Duration = {
|
||||
days: daysToAdd
|
||||
days: daysToAdd,
|
||||
months: monthsToAdd
|
||||
}
|
||||
const newDate = add(oldDate, duration)
|
||||
return newDate
|
||||
|
Reference in New Issue
Block a user