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(deprecation): bring frontend in-sync with model #9303

Merged
merged 2 commits into from
Nov 27, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const UpdateDeprecationModal = ({ urns, onClose, refetch }: Props) => {
resources: [...urns.map((urn) => ({ resourceUrn: urn }))],
deprecated: true,
note: formData.note,
decommissionTime: formData.decommissionTime && formData.decommissionTime.unix(),
decommissionTime: formData.decommissionTime && formData.decommissionTime.unix() * 1000,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,24 @@ export const DeprecationPill = ({ deprecation, urn, refetch, showUndeprecate }:
* Deprecation Decommission Timestamp
*/
const localeTimezone = getLocaleTimezone();

let decommissionTimeSeconds;
if (deprecation.decommissionTime) {
if (deprecation.decommissionTime < 943920000000) {
// Time is set in way past if it was milli-second so considering this as set in seconds
decommissionTimeSeconds = deprecation.decommissionTime;
} else {
decommissionTimeSeconds = deprecation.decommissionTime / 1000;
}
}
const decommissionTimeLocal =
(deprecation.decommissionTime &&
(decommissionTimeSeconds &&
`Scheduled to be decommissioned on ${moment
.unix(deprecation.decommissionTime)
.unix(decommissionTimeSeconds)
.format('DD/MMM/YYYY')} (${localeTimezone})`) ||
undefined;
const decommissionTimeGMT =
deprecation.decommissionTime &&
moment.unix(deprecation.decommissionTime).utc().format('dddd, DD/MMM/YYYY HH:mm:ss z');
decommissionTimeSeconds && moment.unix(decommissionTimeSeconds).utc().format('dddd, DD/MMM/YYYY HH:mm:ss z');

const hasDetails = deprecation.note !== '' || deprecation.decommissionTime !== null;
const isDividerNeeded = deprecation.note !== '' && deprecation.decommissionTime !== null;
Expand Down
Loading