Skip to content

Commit ee91098

Browse files
committed
feat: add util for formatted utc time
1 parent e37e0b6 commit ee91098

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Common/Helper.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
ZERO_TIME_STRING,
3333
TOAST_ACCESS_DENIED,
3434
UNCHANGED_ARRAY_ELEMENT_SYMBOL,
35+
DATE_TIME_FORMATS,
3536
} from './Constants'
3637
import { ServerErrors } from './ServerError'
3738
import { AsyncOptions, AsyncState, UseSearchString } from './Types'
@@ -233,6 +234,9 @@ export function handleUTCTime(ts: string, isRelativeTime = false) {
233234
return timestamp
234235
}
235236

237+
export const getFormattedUTCTimeForExport = (timeToConvert: string, fallback = '-') =>
238+
timeToConvert ? `${moment(timeToConvert).utc().format(DATE_TIME_FORMATS.TWELVE_HOURS_EXPORT_FORMAT)} (UTC)` : '-'
239+
236240
export function useSearchString(): UseSearchString {
237241
const location = useLocation()
238242
const queryParams: URLSearchParams = useMemo(() => {

0 commit comments

Comments
 (0)