diff --git a/desktop/flipper-plugin/src/ui/DataFormatter.tsx b/desktop/flipper-plugin/src/ui/DataFormatter.tsx index 5a087a5e8..41b0abd61 100644 --- a/desktop/flipper-plugin/src/ui/DataFormatter.tsx +++ b/desktop/flipper-plugin/src/ui/DataFormatter.tsx @@ -13,7 +13,7 @@ import { CopyOutlined, } from '@ant-design/icons'; import {Button, Typography} from 'antd'; -import {isPlainObject, pad} from 'lodash'; +import {isPlainObject, padStart} from 'lodash'; import React, {createElement, Fragment, isValidElement, useState} from 'react'; import {_tryGetFlipperLibImplementation} from 'flipper-plugin-core'; import {safeStringify} from 'flipper-plugin-core'; @@ -57,7 +57,7 @@ export const DataFormatter = { res = value.toTimeString().split(' ')[0] + '.' + - pad('' + value.getMilliseconds(), 3, '0'); + padStart('' + value.getMilliseconds(), 3, '0'); break; } if (value instanceof Map) { diff --git a/desktop/flipper-plugin/src/ui/__tests__/DataFormatter.node.tsx b/desktop/flipper-plugin/src/ui/__tests__/DataFormatter.node.tsx index 5fc1818d5..97f57f229 100644 --- a/desktop/flipper-plugin/src/ui/__tests__/DataFormatter.node.tsx +++ b/desktop/flipper-plugin/src/ui/__tests__/DataFormatter.node.tsx @@ -21,6 +21,9 @@ test('default formatter', () => { expect( DataFormatter.format(new Date(2020, 2, 3, 5, 8, 4, 244654)), ).toMatchInlineSnapshot(`"05:12:08.654"`); + expect( + DataFormatter.format(new Date(1668609938.068577 * 1000)), + ).toMatchInlineSnapshot(`"01:45:38.068"`); expect(DataFormatter.format('test')).toMatchInlineSnapshot(`"test"`); expect(DataFormatter.format({hello: 'world'})).toMatchInlineSnapshot(`