2024-01-17 09:37:01 +08:00
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
|
|
export function today() {
|
|
|
|
|
return formatDate(moment());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function lastDay() {
|
|
|
|
|
return formatDate(moment().subtract(1, 'days'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function lastWeek() {
|
|
|
|
|
return formatDate(moment().subtract(1, 'weeks'));
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 19:29:57 +08:00
|
|
|
export function formatDate(date: any) {
|
2024-01-17 09:37:01 +08:00
|
|
|
if (!date) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2024-01-31 19:29:57 +08:00
|
|
|
return moment(date).format('DD/MM/YYYY');
|
2024-01-17 09:37:01 +08:00
|
|
|
}
|