mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
- load the Tooltip component on demand - to show date in format same to Github and Gitea use it for commit ago time tooltips
19 lines
408 B
TypeScript
19 lines
408 B
TypeScript
import dayjs from 'dayjs';
|
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
import timezone from 'dayjs/plugin/timezone';
|
|
import utc from 'dayjs/plugin/utc';
|
|
|
|
dayjs.extend(timezone);
|
|
dayjs.extend(utc);
|
|
dayjs.extend(advancedFormat);
|
|
|
|
export function useDate() {
|
|
function toLocaleString(date: Date) {
|
|
return dayjs(date).format('MMM D, YYYY, HH:mm z');
|
|
}
|
|
|
|
return {
|
|
toLocaleString,
|
|
};
|
|
}
|