Skip to content

Commit

Permalink
UIEXT-941: Translate Z to offset
Browse files Browse the repository at this point in the history
See the open issue here: marnusw/date-fns-tz#174

UIEXT-941 (Date&Time widget displays always browser timezone)
  • Loading branch information
pbaern committed Nov 18, 2024
1 parent d198d03 commit ab3f4ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default {
parseKnimeDateString(dateAndZoneString) {
let match = dateAndZoneString.match(/(.+)\[(.+)]/) || [null, "", ""];
return {
datestring: match[1],
datestring: match[1].replace("Z", "+00:00"),
zonestring: match[2],
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,10 @@ describe("DateTimeWidget.vue", () => {
...context,
});
const res = wrapper.vm.parseKnimeDateString(
"2020-10-10T13:32:45.153[Europe/Berlin]",
"2020-10-10T13:32:45.153Z[UTC]",
);
expect(res.datestring).toBe("2020-10-10T13:32:45.153");
expect(res.zonestring).toBe("Europe/Berlin");
expect(res.datestring).toBe("2020-10-10T13:32:45.153+00:00");
expect(res.zonestring).toBe("UTC");
});

it("parses broken knime date and timezone strings", () => {
Expand Down Expand Up @@ -645,7 +645,7 @@ describe("DateTimeWidget.vue", () => {
it("invalidates if min bound is not kept", () => {
propsAll.nodeConfig.viewRepresentation.usemin = true;
propsAll.nodeConfig.viewRepresentation.min =
"2020-10-10T13:32:45.153[Europe/Berlin]";
"2020-10-10T13:32:45.153+02:00[Europe/Berlin]";
propsAll.nodeConfig.viewRepresentation.usemax = false;
let wrapper = mount(DateTimeWidget, {
props: propsAll,
Expand All @@ -665,7 +665,7 @@ describe("DateTimeWidget.vue", () => {
it("invalidates if max bound is not kept", () => {
propsAll.nodeConfig.viewRepresentation.usemax = true;
propsAll.nodeConfig.viewRepresentation.max =
"2020-04-10T13:32:45.153[Europe/Berlin]";
"2020-04-10T13:32:45.153+02:00[Europe/Berlin]";
propsAll.nodeConfig.viewRepresentation.usemin = false;
let wrapper = mount(DateTimeWidget, {
props: propsAll,
Expand Down

0 comments on commit ab3f4ca

Please sign in to comment.