Skip to content

NXT-4230: Make datetime format consistent with version panel on hub#115

Merged
hriverahdez merged 3 commits intomasterfrom
enh/NXT-4230-webui-for
Feb 13, 2026
Merged

NXT-4230: Make datetime format consistent with version panel on hub#115
hriverahdez merged 3 commits intomasterfrom
enh/NXT-4230-webui-for

Conversation

@xnhp
Copy link
Contributor

@xnhp xnhp commented Feb 11, 2026

NXT-4230 (WebUI for "Change Component Link Version")

Copilot AI review requested due to automatic review settings February 11, 2026 15:38
@xnhp xnhp requested a review from a team as a code owner February 11, 2026 15:38
@xnhp xnhp requested review from knime-ghub-bot and removed request for a team February 11, 2026 15:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates how “created on” timestamps are rendered in the Change Hub Item Version modal to match the datetime formatting used elsewhere (hub version panel).

Changes:

  • Added a formatCreatedOn helper to produce a consistent “Created on {date}, {time}” label.
  • Updated dropdown option construction to use the new helper instead of the prior “Created: {date}” formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xnhp xnhp force-pushed the enh/NXT-4230-webui-for branch from 7785db5 to e8cfb85 Compare February 11, 2026 15:43

const MAX_DESCRIPTION_LENGTH = 120;

const formatCreatedOn = (createdOnValue: string | Date) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have many questions 😄

bottom line: dates are awkward in JS, don't understimate them

Image

Copy link
Contributor Author

@xnhp xnhp Feb 12, 2026

Choose a reason for hiding this comment

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

In the generated gateway API, NamedItemVersion.createdOn is in fact declared as a Date.

But apparently it can be declared a Date but still actually be a String at runtime since (is that correct?) typescript types really "exist" only at compile time.

The locale specification was intentional to be consistent with hub webapp but I do agree that it is awkward.

I made some improvements to the method, is that better?

We can already start defining one singular format for the frontend but not sure if its worth it right now. What do you think?

Copy link
Contributor

@hriverahdez hriverahdez Feb 12, 2026

Choose a reason for hiding this comment

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

But apparently it can be declared a Date but still actually be a String at runtime since (is that correct?) typescript types really "exist" only at compile time.

The type is mapped as Date, but this is just a type. At runtime, the value is transfered over RPC as a date string, so this will never be a Date object

The locale specification was intentional to be consistent with hub webapp

Ah, I see

We can already start defining one singular format for the frontend but not sure if its worth it right now.

Would be a good idea. I can bring it up and we can (later) add it to WAC

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, actually, there's something already in WAC
https://github.com/knime/webapps-common/blob/master/packages/utils/src/format.ts#L10

Maybe you should use that. It seems to be doing the same and to the same format

Copilot AI review requested due to automatic review settings February 12, 2026 10:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 70 to 84
const formatCreatedOn = (createdOnValue: string | Date) => {
const date =
createdOnValue instanceof Date ? createdOnValue : new Date(createdOnValue);
if (Number.isNaN(date.getTime())) {
const rawValue =
createdOnValue instanceof Date ? null : createdOnValue.trim();
return rawValue ? `Created on ${rawValue}` : "Created on unknown date";
}
const dateLabel = formatDateString(date.toISOString());
const timeLabel = new Intl.DateTimeFormat([], {
hour: "numeric",
minute: "2-digit",
}).format(date);
return `Created on ${dateLabel}, ${timeLabel}`;
};
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This mixes UTC and local time: dateLabel is derived from date.toISOString() (UTC-based), while timeLabel is formatted from the Date object in the user’s local timezone. Around midnight, this can produce inconsistent labels like a UTC date with a local time from the previous/next day. Use a single timezone basis for both (e.g., format both parts via the same Intl.DateTimeFormat with an explicit timeZone, or ensure formatDateString formats from the same Date/timezone used for the time).

Copilot uses AI. Check for mistakes.
xnhp added 3 commits February 13, 2026 10:08
NXT-4230 (WebUI for "Change Component Link Version")
NXT-4230 (WebUI for "Change Component Link Version")
Copilot AI review requested due to automatic review settings February 13, 2026 09:28
@xnhp xnhp force-pushed the enh/NXT-4230-webui-for branch from 2c925c5 to 82b92f0 Compare February 13, 2026 09:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link

@hriverahdez hriverahdez merged commit 0739079 into master Feb 13, 2026
12 checks passed
@hriverahdez hriverahdez deleted the enh/NXT-4230-webui-for branch February 13, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants