diff --git a/src/utils/dateFormat.ts b/src/utils/dateFormat.ts index 568d0712..0cc0abda 100644 --- a/src/utils/dateFormat.ts +++ b/src/utils/dateFormat.ts @@ -14,6 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import dayjs from "dayjs"; +import getLocalTime from "@/utils/localtime"; export default function dateFormatStep( date: Date, step: string, @@ -99,3 +101,9 @@ export const dateFormatTime = (date: Date, step: string): string => { } return ""; }; + +export const dateFormat = ( + date: number, + utc: string, + pattern = "YYYY-MM-DD HH:mm:ss" +) => dayjs(getLocalTime(utc, new Date(date))).format(pattern); diff --git a/src/views/dashboard/related/log/LogTable/LogBrowser.vue b/src/views/dashboard/related/log/LogTable/LogBrowser.vue index 0b150477..0703d0d3 100644 --- a/src/views/dashboard/related/log/LogTable/LogBrowser.vue +++ b/src/views/dashboard/related/log/LogTable/LogBrowser.vue @@ -27,7 +27,9 @@ limitations under the License. --> ['message', 'stack'].includes(item.label) ? 'max-item' : '', ]" > - {{ dateFormat(data.time) }} + {{ + dateFormat(data.time, appStore.utc) + }} {{ data.pagePath }} @@ -39,20 +41,19 @@ limitations under the License. -->