This commit is contained in:
Shusui MOYATANI
2023-03-12 13:33:35 +09:00
parent 0e62c4d167
commit bec8352746
18 changed files with 382 additions and 267 deletions

View File

@@ -0,0 +1,21 @@
import { createMemo } from 'solid-js';
import useConfig from '@/nostr/useConfig';
import useDatePulser from '@/hooks/useDatePulser';
import { formatRelative, formatAbsolute } from '@/utils/formatDate';
const useFormatDate = () => {
const { config } = useConfig();
const currentDate = useDatePulser();
return (date: Date) => {
if (config().dateFormat === 'absolute') {
return formatAbsolute(date);
}
return formatRelative(date, currentDate());
};
};
export default useFormatDate;