AI Implementation feature(890): Admin Area General Settings and Categories 1.08 (#30)
This commit was merged in pull request #30.
This commit is contained in:
@@ -60,7 +60,16 @@ export function toDatetimeLocal(iso: string): string {
|
||||
|
||||
export function toIsoUtc(local: string): string {
|
||||
if (!local) return '';
|
||||
const d = new Date(local);
|
||||
const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/.exec(local);
|
||||
if (!m) return local;
|
||||
const year = Number(m[1]);
|
||||
const monthIndex = Number(m[2]) - 1;
|
||||
const day = Number(m[3]);
|
||||
const hours = Number(m[4]);
|
||||
const minutes = Number(m[5]);
|
||||
const seconds = m[6] ? Number(m[6]) : 0;
|
||||
const millis = m[7] ? Number(m[7].padEnd(3, '0')) : 0;
|
||||
const d = new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, millis));
|
||||
if (Number.isNaN(d.getTime())) return local;
|
||||
return d.toISOString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user