diff options
3 files changed, 9 insertions, 2 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/DeviceListItem.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/DeviceListItem.tsx index bfb834fd5a..9371f556f8 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/DeviceListItem.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/DeviceListItem.tsx @@ -11,7 +11,7 @@ import { spacings } from '../../lib/foundations'; import { useBoolean } from '../../lib/utility-hooks'; import { DeviceListItemProvider, useDeviceListItemContext } from './'; import { ConfirmDialog, ErrorDialog, RemoveButton } from './components'; -import { useIsCurrentDevice } from './hooks'; +import { useFormattedDate, useIsCurrentDevice } from './hooks'; export type SettingsToggleListItemProps = { device: IDevice; @@ -32,9 +32,9 @@ const StyledListItem = styled(ListItem)<{ $isCurrentDevice: boolean }>( function DeviceListItemInner({ ...props }: Omit<SettingsToggleListItemProps, 'device'>) { const { device, deleting, confirmDialogVisible, error } = useDeviceListItemContext(); + const createdDate = useFormattedDate(device.created); const isCurrentDevice = useIsCurrentDevice(); const deviceName = capitalizeEveryWord(device.name); - const createdDate = device.created.toISOString().split('T')[0]; return ( <> diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/index.ts b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/index.ts index 66b75dd486..d8626923b4 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/index.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/index.ts @@ -1 +1,2 @@ export * from './use-is-current-device'; +export * from './use-formatted-date'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/use-formatted-date.ts b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/use-formatted-date.ts new file mode 100644 index 0000000000..5ddc670aad --- /dev/null +++ b/desktop/packages/mullvad-vpn/src/renderer/components/device-list-item/hooks/use-formatted-date.ts @@ -0,0 +1,6 @@ +export function useFormattedDate(date: Date) { + const year = date.getUTCFullYear(); + const month = String(date.getUTCMonth() + 1).padStart(2, '0'); + const day = String(date.getUTCDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} |
