use .toLocaleString instead of UTC

Signed-off-by: Wesley <wpattison08@gmail.com>
This commit is contained in:
Wesley
2022-09-15 05:07:54 +02:00
parent 7312ee6125
commit 1148bdba7d
2 changed files with 8 additions and 2 deletions
@@ -28,6 +28,7 @@ import {
TestApiProvider,
} from '@backstage/test-utils';
import { setupServer } from 'msw/node';
import { DateTime } from 'luxon';
import { functionResponseMock } from '../../mocks/mocks';
import { azureFunctionsApiRef } from '../..';
import { OverviewTable } from './OverviewTable';
@@ -79,7 +80,10 @@ describe('AzureFunctionsOverviewWidget', () => {
).toBeInTheDocument();
expect(
await rendered.findByText(
new Date(functionResponseMock.lastModifiedDate).toUTCString(),
functionResponseMock.lastModifiedDate.toLocaleString(
window.navigator.language,
DateTime.DATETIME_FULL,
),
),
).toBeInTheDocument();
});
@@ -19,8 +19,10 @@ import { Box, Card, Link, LinearProgress } from '@material-ui/core';
import { FunctionsData } from '@backstage/plugin-azure-functions-common';
import { Table, TableColumn } from '@backstage/core-components';
import FlashOnIcon from '@material-ui/icons/FlashOn';
import { DateTime } from 'luxon';
type States = 'Waiting' | 'Running' | 'Paused' | 'Failed';
const lang = window.navigator.language;
const State = ({ value }: { value: States }) => {
const colorMap = {
@@ -74,7 +76,7 @@ const DEFAULT_COLUMNS: TableColumn<FunctionsData>[] = [
{
title: 'last modified',
render: (func: FunctionsData) =>
new Date(func.lastModifiedDate).toUTCString(),
func.lastModifiedDate.toLocaleString(lang, DateTime.DATETIME_FULL),
},
{
title: 'logs',