fix. [ECW-18] 점검 시간 UTC 시간 오류 수정
This commit is contained in:
@@ -30,10 +30,7 @@
|
||||
{{ tm('Inspection_Maintenance_Time') }}
|
||||
</h2>
|
||||
<div class="inspection-time text-sm md:text-base font-medium">
|
||||
<div
|
||||
v-dompurify-html="getLocaleTimezone('', '')"
|
||||
class="time-row"
|
||||
></div>
|
||||
<div v-dompurify-html="getLocaleTimezone" class="time-row"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -152,10 +149,10 @@ await getInspectionDataExternal({
|
||||
// zh-tw: 台灣時間 (KST)
|
||||
// ja: (JST)
|
||||
// 나머지: (KST)
|
||||
const getLocaleTimezone = (localeType: string, region) => {
|
||||
const getLocaleTimezone = () => {
|
||||
const tsStartDate = webInspectionData.value?.ts_start_date || 0
|
||||
const tsEndDate = webInspectionData.value?.ts_end_date || 0
|
||||
const currentLocale = localeType || locale.value
|
||||
const currentLocale = locale.value
|
||||
|
||||
const timezoneMap: Record<string, string> = {
|
||||
ko: 'KST',
|
||||
@@ -168,11 +165,16 @@ const getLocaleTimezone = (localeType: string, region) => {
|
||||
const timezone = timezoneMap[currentLocale] || 'KST'
|
||||
const defaultRegion = currentLocale === 'ko' ? 'KR' : ''
|
||||
|
||||
const formatDate = (date: Date, loc: string, reg: string) =>
|
||||
`${globalDateFormat(date, loc, reg || defaultRegion, { useFullDate: true })}`
|
||||
const formatDate = (
|
||||
date: Date,
|
||||
loc: string,
|
||||
reg: string,
|
||||
{ useUtc }: { useUtc: boolean } = { useUtc: false }
|
||||
) =>
|
||||
`${globalDateFormat(date, loc, reg || defaultRegion, { useFullDate: true, useUtc: useUtc })}`
|
||||
|
||||
const localTime = `${formatDate(new Date(tsStartDate), currentLocale, region || '')} <br class="md:hidden">~ ${formatDate(new Date(tsEndDate), currentLocale, region || '')} (${timezone})`
|
||||
const utcTime = `${formatDate(new Date(tsStartDate), 'en', region || '')} <br class="md:hidden">~ ${formatDate(new Date(tsEndDate), 'en', region || '')} (UTC)`
|
||||
const localTime = `${formatDate(new Date(tsStartDate), currentLocale, '')} <br class="md:hidden">~ ${formatDate(new Date(tsEndDate), currentLocale, '')} (${timezone})`
|
||||
const utcTime = `${formatDate(new Date(tsStartDate), 'en', '', { useUtc: true })} <br class="md:hidden">~ ${formatDate(new Date(tsEndDate), 'en', '', { useUtc: true })} (UTC)`
|
||||
|
||||
return currentLocale === 'en' ? utcTime : `${localTime}<br>${utcTime}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user