Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Render timestamp of protobuf in UTC #98

Merged
merged 1 commit into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Literals/Scalar/PrimitiveValue.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { formatDate, protobufDurationToHMS } from 'common/formatters';
import { formatDateUTC, protobufDurationToHMS } from 'common/formatters';
import { timestampToDate } from 'common/utils';
import { Primitive } from 'models';

Expand All @@ -10,7 +10,7 @@ function primitiveToString(primitive: Primitive): string {
case 'boolean':
return !!primitive.boolean ? 'true' : 'false';
case 'datetime':
return formatDate(timestampToDate(primitive.datetime!));
return formatDateUTC(timestampToDate(primitive.datetime!));
Copy link
Contributor

@EngHabu EngHabu Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the dates that show in the "Inputs/Outputs" tab for a task/execution?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Literals components are used anywhere we render a flyte Literal value to the screen. So that would be the inputs/outputs modal for workflow executions, the inputs/outputs tab in the details panel for a task execution, and I think maybe certain cases in the Launch form when rendering a fixed input value that the user cannot change.

case 'duration':
return protobufDurationToHMS(primitive.duration!);
default:
Expand Down
25 changes: 25 additions & 0 deletions src/components/Literals/Scalar/test/PrimitiveValue.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render } from '@testing-library/react';
import * as React from 'react';

import { Primitive } from 'models';
import { PrimitiveValue } from '../PrimitiveValue';

import { long } from 'test/utils';

describe('PrimitiveValue', () => {
it('renders datetime', () => {
const primitive: Primitive = {
value: 'datetime',
datetime: {
seconds: long(3600),
nanos: 0
},
boolean: false,
integer: long(0),
floatValue: 0,
stringValue: ''
};
const { getByText } = render(<PrimitiveValue primitive={primitive} />);
expect(getByText('1/1/1970 1:00:00 AM UTC')).toBeInTheDocument();
});
});