first commit

This commit is contained in:
Net 2024-04-02 11:02:16 +07:00
commit e8ec46d19f
60 changed files with 13652 additions and 0 deletions

22
src/utils/datetime.ts Normal file
View file

@ -0,0 +1,22 @@
import 'moment/dist/locale/th';
import moment from 'moment';
moment.locale('th');
export function setLocale(locale: string) {
moment.locale(locale);
}
export function dateFormat(
date?: string | Date | null,
fullmonth = false,
time = false,
) {
const m = moment(date);
if (!m.isValid()) return '';
const month = m.format(fullmonth ? 'MMMM' : 'MMM');
return m.format(`DD ${month} YYYY ${time ? ' HH:mm' : ''}`);
}