1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

linting error fix

This commit is contained in:
gras 2024-03-31 19:20:07 +02:00
parent 84928e6371
commit 1e50f1b2e5

View File

@ -224,7 +224,7 @@ export class Utils {
//this function makes sure that if date is the 31st and you add a month, you will get the last day of the next month //this function makes sure that if date is the 31st and you add a month, you will get the last day of the next month
//so adding or subtracting a month from 31st of march will give 30th of april or 28th of february respectively (29th on leap years). //so adding or subtracting a month from 31st of march will give 30th of april or 28th of february respectively (29th on leap years).
static addMonthToDate(date: Date, numMonths: number) { static addMonthToDate(date: Date, numMonths: number) {
let result = new Date(date) const result = new Date(date)
const expectedMonth = ((date.getMonth() + numMonths) % 12 + 12) % 12; //inner %12 + 12 makes correct handling of negative months const expectedMonth = ((date.getMonth() + numMonths) % 12 + 12) % 12; //inner %12 + 12 makes correct handling of negative months
result.setMonth(result.getMonth() + numMonths); result.setMonth(result.getMonth() + numMonths);
if (result.getMonth() !== expectedMonth) { if (result.getMonth() !== expectedMonth) {