Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

MAT-7679 add other supported time zones #722

Merged
merged 1 commit into from
Oct 9, 2024
Merged
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 @@ -25,17 +25,27 @@
label: string;
}
const options: MenuObj[] = [
{ value: "America/Puerto_Rico", label: "AST" },
{ value: "America/New_York", label: "EST" },
{ value: "America/Chicago", label: "CST" },
{ value: "America/Denver", label: "MST" },
{ value: "America/Los_Angeles", label: "PST" },
{ value: "America/Anchorage", label: "AKST" },
{ value: "America/honolulu", label: "HST" },
{ value: "America/American_Samoa", label: "WST" },
{ value: "America/Saipan", label: "CHST" },
];

const offSets = [
{ id: "America/Puerto_Rico - AST", value: "-04:00" },
{ id: "America/New_York - EST", value: "-05:00" },
{ id: "America/Chicago - CST", value: "-06:00" },
{ id: "America/Denver - MST", value: "-07:00" },
{ id: "America/Los_Angeles - PST", value: "-08:00" },
{ id: "America/Anchorage - AKST", value: "-09:00" },
{ id: "America/honolulu - HST", value: "-10:00" },
{ id: "America/American_Samoa - WST", value: "-11:00" },
{ id: "America/Saipan - CHST", value: "+10:00" },
];

const findByLabel = (value) => {
Expand Down Expand Up @@ -65,6 +75,18 @@
return result;
};

const findByOffSet = (value) => {
let result = "America/New_York - EST";

Check warning on line 79 in src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx#L79

Added line #L79 was not covered by tests
if (value) {
offSets.forEach((opt) => {

Check warning on line 81 in src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx#L81

Added line #L81 was not covered by tests
if (opt.value === value) {
result = opt.id;

Check warning on line 83 in src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx#L83

Added line #L83 was not covered by tests
}
});
}
return result;

Check warning on line 87 in src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx#L87

Added line #L87 was not covered by tests
};

const DateTimeComponent = ({
canEdit,
fieldRequired,
Expand Down Expand Up @@ -99,6 +121,9 @@
converted = convertToStandardTime(converted).tz(userTimeZone);

setTimeZone(findByLabel(timezoneName.replace("D", "S")));
} else if (timezoneName.includes("GMT")) {
const zone = findByOffSet(timezoneName.substring(3, 6) + ":00");
setTimeZone(zone);

Check warning on line 126 in src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/editTestCase/qiCore/LeftPanel/ElementsTab/builder/element/types/DateTimeComponent.tsx#L125-L126

Added lines #L125 - L126 were not covered by tests
} else {
setTimeZone(findByLabel(timezoneName));
}
Expand Down
Loading