]> BookStack Code Mirror - bookstack/blob - resources/js/services/dates.js
Added test for logical-theme-system command registration
[bookstack] / resources / js / services / dates.js
1
2 export function getCurrentDay() {
3     let date = new Date();
4     let month = date.getMonth() + 1;
5     let day = date.getDate();
6
7     return `${date.getFullYear()}-${(month>9?'':'0') + month}-${(day>9?'':'0') + day}`;
8 }
9
10 export function utcTimeStampToLocalTime(timestamp) {
11     let date = new Date(timestamp * 1000);
12     let hours = date.getHours();
13     let mins = date.getMinutes();
14     return `${(hours>9?'':'0') + hours}:${(mins>9?'':'0') + mins}`;
15 }
16
17 export function formatDateTime(date) {
18     let month = date.getMonth() + 1;
19     let day = date.getDate();
20     let hours = date.getHours();
21     let mins = date.getMinutes();
22
23     return `${date.getFullYear()}-${(month>9?'':'0') + month}-${(day>9?'':'0') + day} ${(hours>9?'':'0') + hours}:${(mins>9?'':'0') + mins}`;
24 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.