Quellcode durchsuchen

fix: 删除时区时间多余时分秒

zhouyuhao vor 1 Jahr
Ursprung
Commit
1f6993f746

+ 7 - 3
src/components/ContainerStatus/src/ContainerStatus.vue

@@ -26,9 +26,13 @@ watch(
   }
 )
 
-const formatTimezone = (tiem: string, timezone: string) => {
-  if (!tiem) return '--'
-  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY hh:mm A')
+const formatTimezone = (time: string, timezone: string) => {
+  if (!time) return '--'
+
+  const formattedTime =
+    time.length !== 10
+      ? dayjs(time).format('MMM-DD-YYYY hh:mm A')
+      : dayjs(time).format('MMM-DD-YYYY')
   let gmtOffset = ''
   if (timezone && timezone.length > 3) {
     const timeZoneOffset = dayjs().tz(timezone).format('Z')

+ 3 - 3
src/views/Booking/src/components/BookingDetail/src/BookingDetail.vue

@@ -91,9 +91,9 @@ const getData = () => {
 }
 getData()
 
-const formatTimezone = (tiem: string, timezone: string) => {
-  if (!tiem) return '--'
-  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY hh:mm A')
+const formatTimezone = (time: string, timezone: string) => {
+  if (!time) return '--'
+  const formattedTime = dayjs(time).format('MMM-DD-YYYY')
   let gmtOffset = ''
   if (timezone && timezone.length > 3) {
     const timeZoneOffset = dayjs().tz(timezone).format('Z')

+ 4 - 1
src/views/Tracking/src/components/PublicTracking/src/components/MilestonesTable.vue

@@ -46,7 +46,10 @@ const handleColumns = (columns: any) => {
         ...curColumn,
         formatter: ({ cellValue, row }: any) => {
           if (!cellValue) return '--'
-          const formattedTime = dayjs(cellValue).format('MMM-DD-YYYY hh:mm A')
+          const formattedTime =
+            cellValue.length !== 10
+              ? dayjs(cellValue).format('MMM-DD-YYYY hh:mm A')
+              : dayjs(cellValue).format('MMM-DD-YYYY')
           let gmtOffset = ''
           if (row.timezone && row.timezone.length > 3) {
             const timeZoneOffset = dayjs().tz(row.timezone).format('Z')

+ 3 - 3
src/views/Tracking/src/components/PublicTracking/src/components/PublicTrackingDetail.vue

@@ -68,9 +68,9 @@ if (Object.keys(sharedData).length === 0) {
   allData.value = sharedData
 }
 
-const formatTimezone = (tiem: string, timezone: string) => {
-  if (!tiem) return '--'
-  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY hh:mm A')
+const formatTimezone = (time: string, timezone: string) => {
+  if (!time) return '--'
+  const formattedTime = dayjs(time).format('MMM-DD-YYYY')
   let gmtOffset = ''
   if (timezone && timezone.length > 3) {
     const timeZoneOffset = dayjs().tz(timezone).format('Z')

+ 1 - 1
src/views/Tracking/src/components/TrackingDetail/src/TrackingDetail.vue

@@ -112,7 +112,7 @@ getData()
 
 const formatTimezone = (tiem: string, timezone: string) => {
   if (!tiem) return '--'
-  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY hh:mm A')
+  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY')
   let gmtOffset = ''
   if (timezone && timezone.length > 3) {
     const timeZoneOffset = dayjs().tz(timezone).format('Z')

+ 4 - 1
src/views/Tracking/src/components/TrackingDetail/src/components/MilestonesTable.vue

@@ -48,7 +48,10 @@ const handleColumns = (columns: any) => {
         ...curColumn,
         formatter: ({ row, cellValue }: any) => {
           if (!cellValue) return '--'
-          const formattedTime = dayjs(cellValue).format('MMM-DD-YYYY hh:mm A')
+          const formattedTime =
+            cellValue.length !== 10
+              ? dayjs(cellValue).format('MMM-DD-YYYY hh:mm A')
+              : dayjs(cellValue).format('MMM-DD-YYYY')
           let gmtOffset = ''
           if (row.timezone && row.timezone.length > 3) {
             const timeZoneOffset = dayjs().tz(row.timezone).format('Z')