mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 23:39:37 +02:00
Refactor toLocalDatetime function to improve ISO date handling and return format
This commit is contained in:
parent
ab189c8aff
commit
c9fa1d55f7
1 changed files with 3 additions and 3 deletions
|
@ -12,10 +12,10 @@ export function toLocalDatetime(
|
|||
timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||
): string {
|
||||
if (!utcDate) return '';
|
||||
return DateTime.fromISO(utcDate, { zone: 'UTC' })
|
||||
const isoString = DateTime.fromISO(utcDate, { zone: 'UTC' })
|
||||
.setZone(timezone)
|
||||
.toISO({ suppressSeconds: true, includeOffset: false })
|
||||
.slice(0, 16);
|
||||
.toISO({ suppressSeconds: true, includeOffset: false });
|
||||
return isoString ? isoString.slice(0, 16) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue