Add schema validation and sync metadata UI
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
export function formatDateTime(value?: string) {
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const time = Date.parse(value);
|
||||
if (Number.isNaN(time)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return new Intl.DateTimeFormat('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
}).format(new Date(time));
|
||||
}
|
||||
|
||||
export function getLatestDate(values: string[]) {
|
||||
const timestamps = values.map((value) => Date.parse(value)).filter((value) => !Number.isNaN(value));
|
||||
if (timestamps.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return new Date(Math.max(...timestamps)).toISOString();
|
||||
}
|
||||
Reference in New Issue
Block a user