mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-16 21:46:32 +00:00
d1c51f4af8
1. new translation docs 2. lazy-load TimeAgo locales (used for "x min ago" messages). This 1. reduces size and 2. provides all languages without adding them manually. 3. Remove DayJS locales, they're unused.
19 lines
446 B
TypeScript
19 lines
446 B
TypeScript
import dayjs from 'dayjs';
|
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
import timezone from 'dayjs/plugin/timezone';
|
|
import utc from 'dayjs/plugin/utc';
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
dayjs.extend(timezone);
|
|
dayjs.extend(utc);
|
|
dayjs.extend(advancedFormat);
|
|
|
|
export function useDate() {
|
|
function toLocaleString(date: Date) {
|
|
return dayjs(date).format(useI18n().t('time.tmpl'));
|
|
}
|
|
|
|
return {
|
|
toLocaleString,
|
|
};
|
|
}
|