moved date format functions to utilities

This commit is contained in:
vabene1111
2024-01-23 18:25:56 +01:00
parent 64e54ceaec
commit 7673e794bf
3 changed files with 21 additions and 22 deletions

View File

@ -365,6 +365,23 @@ export function energyHeading() {
}
}
export const FormatMixin = {
name: "FormatMixin",
methods: {
/**
* format short date from datetime
* @param datetime any string that can be parsed by Date.parse()
* @return {string}
*/
formatDate: function (datetime) {
return Intl.DateTimeFormat(window.navigator.language, {
dateStyle: "short",
}).format(Date.parse(datetime))
},
},
}
axios.defaults.xsrfCookieName = "csrftoken"
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"