|
15 | 15 | // specific language governing permissions and limitations |
16 | 16 | // under the License. |
17 | 17 | import store from '@/store' |
| 18 | +import { vueProps } from '@/vue-app' |
18 | 19 |
|
19 | 20 | import dayjs from 'dayjs' |
20 | 21 | import utc from 'dayjs/plugin/utc' |
@@ -80,22 +81,31 @@ export function toLocaleDate ({ date, timezoneoffset = store.getters.timezoneoff |
80 | 81 | return null |
81 | 82 | } |
82 | 83 |
|
83 | | - let dateWithOffset = toLocalDate({ date, timezoneoffset, usebrowsertimezone }).toUTCString() |
| 84 | + let dateWithOffset = toLocalDate({ date, timezoneoffset, usebrowsertimezone }).toLocaleString('ko-KR', { timeZone: 'UTC' }) |
| 85 | + if (dateOnly) { |
| 86 | + return dateWithOffset.substring(0, dateWithOffset.length - 10) |
| 87 | + } |
| 88 | + if (hourOnly) { |
| 89 | + return dateWithOffset.substring(dateWithOffset.length - 10, dateWithOffset.length) |
| 90 | + } |
84 | 91 |
|
85 | | - // e.g. "Mon, 03 Jun 2024 19:22:55 GMT" -> "03 Jun 2024 19:22:55 GMT" |
86 | | - dateWithOffset = dateWithOffset.substring(dateWithOffset.indexOf(', ') + 2) |
| 92 | + if (vueProps.$localStorage.get('LOCALE') !== 'ko_KR') { |
| 93 | + dateWithOffset = toLocalDate({ date, timezoneoffset, usebrowsertimezone }).toUTCString() |
| 94 | + // e.g. "Mon, 03 Jun 2024 19:22:55 GMT" -> "03 Jun 2024 19:22:55 GMT" |
| 95 | + dateWithOffset = dateWithOffset.substring(dateWithOffset.indexOf(', ') + 2) |
87 | 96 |
|
88 | | - // e.g. "03 Jun 2024 19:22:55 GMT" -> "03 Jun 2024 19:22:55" |
89 | | - dateWithOffset = dateWithOffset.substring(0, dateWithOffset.length - 4) |
| 97 | + // e.g. "03 Jun 2024 19:22:55 GMT" -> "03 Jun 2024 19:22:55" |
| 98 | + dateWithOffset = dateWithOffset.substring(0, dateWithOffset.length - 4) |
90 | 99 |
|
91 | | - if (dateOnly) { |
92 | | - // e.g. "03 Jun 2024 19:22:55" -> "03 Jun 2024" |
93 | | - return dateWithOffset.substring(0, dateWithOffset.length - 9) |
94 | | - } |
| 100 | + if (dateOnly) { |
| 101 | + // e.g. "03 Jun 2024 19:22:55" -> "03 Jun 2024" |
| 102 | + return dateWithOffset.substring(0, dateWithOffset.length - 9) |
| 103 | + } |
95 | 104 |
|
96 | | - if (hourOnly) { |
97 | | - // e.g. "03 Jun 2024 19:22:55" -> "19:22:55" |
98 | | - return dateWithOffset.substring(dateWithOffset.length - 8, dateWithOffset.length) |
| 105 | + if (hourOnly) { |
| 106 | + // e.g. "03 Jun 2024 19:22:55" -> "19:22:55" |
| 107 | + return dateWithOffset.substring(dateWithOffset.length - 8, dateWithOffset.length) |
| 108 | + } |
99 | 109 | } |
100 | 110 |
|
101 | 111 | return dateWithOffset |
|
0 commit comments