-
Notifications
You must be signed in to change notification settings - Fork 10
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(i18n): compatible with timestamp in milliseconds or null values #1775
base: main
Are you sure you want to change the base?
Conversation
packages/core/i18n/src/i18n.ts
Outdated
const invalidDate = 'Invalid Date' | ||
if (!timestamp) { | ||
return invalidDate | ||
return '-' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not saying this is wrong change, but would some places where user expects to see Invalid Date
and now sees -
be "broken" or "changed without the user's content" ? Also are we sure there are no tests that expects Invalid Date
?
Seems that the change is not related to shameful normalize and can be excluded from this PR, unless it's absolutely needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can revert this change, as it was intended to handle potential null
values returned by backend APIs, and we are already providing the correct fallback value (use created_at
if updated_at
is null
). I’m just curious to understand if there are any scenarios in our current design where we might expect to see Invalid Date
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this string anywhere in the tests. So looks like safe change. If someone complains we just file JIRA and fix :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Can you stamp this one?
packages/core/i18n/src/i18n.ts
Outdated
const invalidDate = 'Invalid Date' | ||
if (!timestamp) { | ||
return invalidDate | ||
return '-' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return '-' | |
return '—' |
Can we use emdash instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should just remove this. We are already handling null
before this.
b94d828
to
ea9873e
Compare
@@ -52,6 +52,19 @@ export const createI18n = <MessageSource extends Record<string, any>> | |||
const { $t, ...otherProps } = intlOriginal | |||
const intl = otherProps | |||
|
|||
/** | |||
* Shamefully normalize a timestamp to be in seconds as some APIs are returning timestamps in milliseconds | |||
* TODO: Remove this function once all timestamps are normalized from the backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ticket for the backend: MA-3412
I've updated the code and no longer handles |
Preview components from this PR in consuming applicationIn consuming application project install preview versions of shared packages generated by this PR:
|
Summary
The filter API is returning timestamps in milliseconds instead of seconds and
null
asupdated_at
values for those weren't modified since created. The issue affects both filtered services and routes.Before:
After: