Move into app/
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import dayjs from 'dayjs'
|
||||
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
||||
import 'dayjs/locale/th'
|
||||
import 'dayjs/locale/en'
|
||||
|
||||
dayjs.extend(localizedFormat)
|
||||
|
||||
export const useFormatDate = (date: string) => {
|
||||
const localizedDayjs = dayjs(date).locale('en')
|
||||
return localizedDayjs.format('D MMMM YYYY - HH:mm')
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import 'dayjs/locale/en'
|
||||
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
export const useRelativeDate = (date: string) => {
|
||||
dayjs.locale('en')
|
||||
return dayjs().to(dayjs(date))
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
export const useFontLists = (fontUrl: string, fontListFile: string) => {
|
||||
const {data: fonts, error, pending} = useFetch(fontUrl + fontListFile, {
|
||||
key: 'font-lists',
|
||||
server: false,
|
||||
lazy: false,
|
||||
});
|
||||
return {
|
||||
fonts,
|
||||
error,
|
||||
pending
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user