mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 15:36:50 +08:00
### What problem does this PR solve? Fix: Add agent-log-list page And RAPTOR:Save directly after enabling, incomplete form submission #3221 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
46 lines
832 B
TypeScript
46 lines
832 B
TypeScript
import dayjs from 'dayjs';
|
|
|
|
export function formatDate(date: any) {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return dayjs(date).format('DD/MM/YYYY HH:mm:ss');
|
|
}
|
|
|
|
export function formatTime(date: any) {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return dayjs(date).format('HH:mm:ss');
|
|
}
|
|
|
|
export function today() {
|
|
return formatDate(dayjs());
|
|
}
|
|
|
|
export function lastDay() {
|
|
return formatDate(dayjs().subtract(1, 'days'));
|
|
}
|
|
|
|
export function lastWeek() {
|
|
return formatDate(dayjs().subtract(1, 'weeks'));
|
|
}
|
|
|
|
export function formatPureDate(date: any) {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return dayjs(date).format('DD/MM/YYYY');
|
|
}
|
|
|
|
export function formatStandardDate(date: any) {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
const parsedDate = dayjs(date);
|
|
if (!parsedDate.isValid()) {
|
|
return '';
|
|
}
|
|
return parsedDate.format('YYYY-MM-DD');
|
|
}
|