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:
parent
d79abb3d93
commit
72b88b8387
@ -29,7 +29,6 @@
|
||||
"discord-api-types": "^0.27.3",
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^16.0.0",
|
||||
"eslint": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"typescript": "^4.4.4",
|
||||
"winston": "^3.3.3"
|
||||
@ -39,6 +38,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
||||
"@typescript-eslint/parser": "^5.3.0",
|
||||
"jest": "^27.3.1",
|
||||
"eslint": "^8.2.0",
|
||||
"jest-cli": "^27.3.1",
|
||||
"nodemon": "^2.0.14",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user