1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

JS: Converted a few extra services to TS

This commit is contained in:
Dan Brown
2024-10-04 14:36:20 +01:00
parent 2766c76491
commit 346b88ae43
12 changed files with 39 additions and 71 deletions

View File

@@ -0,0 +1,14 @@
export function getCurrentDay(): string {
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${date.getFullYear()}-${(month > 9 ? '' : '0') + month}-${(day > 9 ? '' : '0') + day}`;
}
export function utcTimeStampToLocalTime(timestamp: number): string {
const date = new Date(timestamp * 1000);
const hours = date.getHours();
const mins = date.getMinutes();
return `${(hours > 9 ? '' : '0') + hours}:${(mins > 9 ? '' : '0') + mins}`;
}