BookStack/resources/assets/js/services/dates.js
Dan Brown 0ade9b5b9b
Refactored moment.js out of app
Reduces bundle size by 25%
2018-04-01 14:10:44 +01:00

15 lines
453 B
JavaScript

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