1
0

Add nextWeek template variable (#109)

This commit is contained in:
Ben Schumacher 2022-11-03 13:14:43 +01:00 committed by GitHub
parent bb6bf289d9
commit 334550675a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -105,6 +105,11 @@ export function replaceTemplateVars(s: string, pageName: string): string {
lastWeek.setDate(lastWeek.getDate() - 7);
return niceDate(lastWeek);
}
case "nextWeek": {
const nextWeek = new Date();
nextWeek.setDate(nextWeek.getDate() + 7);
return niceDate(nextWeek);
}
case "page":
return pageName;
}

View File

@ -84,4 +84,5 @@ Currently supported (hardcoded in the code):
- `{{tomorrow}}`: Tomorrows date in the usual YYY-MM-DD format
- `{{yesterday}}`: Yesterdays date in the usual YYY-MM-DD format
- `{{lastWeek}}`: Current date - 7 days
- `{{nextWeek}}`: Current date + 7 days
- `{{page}}`: The name of the current page