release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
1 changed files with 21 additions and 23 deletions
Showing only changes of commit 296245457d - Show all commits

View File

@ -1,29 +1,27 @@
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
export default boot(({ Vue }) => { export default boot(({ Vue }) => {
function formatDate(date: Date) { function formatDateTime(
let d = date.getDate().toString(); date: Date,
if (d.length == 1) d = '0' + d; useDate = true,
let m = date.getMonth().toString(); useTime = false,
if (m.length == 1) m = '0' + m; useSeconds = false,
return `${d}.${m}.${date.getFullYear().toString()}`; useWeekday = false
) {
const dateTimeFormat = new Intl.DateTimeFormat([], {
year: useDate ? 'numeric' : undefined,
month: useDate ? '2-digit' : undefined,
day: useDate ? '2-digit' : undefined,
weekday: useWeekday ? 'long' : undefined,
hour: useTime ? '2-digit' : undefined,
minute: useTime ? '2-digit' : undefined,
second: useTime && useSeconds ? '2-digit' : undefined
});
return dateTimeFormat.format(date);
} }
Vue.filter('date', formatDate); Vue.filter('date', formatDateTime);
Vue.filter('time', (date: Date, seconds = false) =>
Vue.filter('dateTime', function(date: Date, seconds = false) { formatDateTime(date, false, true, seconds)
let H = date.getHours().toString(); );
if (H.length == 1) H = `0${H}`;
let M = date.getMinutes().toString();
if (M.length == 1) M = `0${M}`;
let S = '';
if (seconds) {
S =
':' +
(date.getSeconds() > 9
? date.getSeconds().toString()
: `0${date.getSeconds().toString()}`);
}
return `${formatDate(date)} ${H}:${M}${S}`;
});
}); });