fix: incorrect timestamp timezone conversion and relative time preview#40420
Conversation
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 22e248e The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdded description and hint to the Time zone picker, reordered controls in the Timestamp picker modal so Preview appears first, adjusted two full date-time format strings, updated RelativeTime to respect locale during refreshes and added tests, and updated English locale entries for timestamp labels and descriptions. No public API signature changes. ChangesTimestamp UI, Localization, and Formatting
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40420 +/- ##
===========================================
- Coverage 69.64% 69.59% -0.06%
===========================================
Files 3327 3325 -2
Lines 122770 122710 -60
Branches 21902 21937 +35
===========================================
- Hits 85509 85396 -113
- Misses 33920 33992 +72
+ Partials 3341 3322 -19
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/client/lib/utils/timestamp/formats.ts`:
- Around line 24-28: The 'f' format object (label 'timestamps.fullDateTime')
currently uses 'PPPP p' which drops seconds; update the 'f' entry in formats.ts
to either include seconds by changing format to 'PPPP pp' (to match the
long-time variant used by 'F') or else adjust the label/description to indicate
it's a short-time full-datetime (no seconds); modify the object with key 'f'
accordingly so the format and label/description are consistent.
In `@packages/i18n/src/locales/en.i18n.json`:
- Around line 5372-5373: Update the copy for the localization keys
Timezone_picker_description and Timezone_picker_hint to improve grammar and
terminology consistency: change Timezone_picker_description to "Select the time
zone for the entered time." and change Timezone_picker_hint to "Others see
timestamps converted to their own time zone." Ensure both keys use the two-word
"time zone" consistently and include the final punctuation as shown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 65e5d7a3-ecc6-40ae-9691-a168a3a4692a
⛔ Files ignored due to path filters (1)
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/__snapshots__/TimestampPicker.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (5)
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal.tsxapps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimezoneSelector.tsxapps/meteor/client/lib/utils/timestamp/formats.tspackages/gazzodown/src/elements/Timestamp/index.tsxpackages/i18n/src/locales/en.i18n.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal.tsxapps/meteor/client/lib/utils/timestamp/formats.tspackages/gazzodown/src/elements/Timestamp/index.tsxapps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimezoneSelector.tsx
🧠 Learnings (5)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal.tsxpackages/gazzodown/src/elements/Timestamp/index.tsxapps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimezoneSelector.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal.tsxapps/meteor/client/lib/utils/timestamp/formats.tspackages/gazzodown/src/elements/Timestamp/index.tsxapps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimezoneSelector.tsx
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/lib/utils/timestamp/formats.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/client/lib/utils/timestamp/formats.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/client/lib/utils/timestamp/formats.ts
🔇 Additional comments (6)
packages/i18n/src/locales/en.i18n.json (2)
7199-7202: LGTM for timestamp option naming updates.These labels are clearer and map well to the format choices shown in the picker.
7207-7207: Looks good.The updated example string is suitable for the revised timestamp format option.
apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimezoneSelector.tsx (2)
29-33:FieldDescriptionbeforeFieldRow,FieldHintafter — placement is correct.The ordering matches the standard fuselage Field composition pattern (
FieldLabel → FieldDescription → FieldRow → FieldHint). LGTM assumingFieldDescriptionis confirmed available (see import comment above).
1-1: ⚡ Quick winRemove this verification request.
FieldDescriptionis already being imported and successfully used in multiple files across the codebase (FormSkeleton.tsx, PeerAutocomplete.tsx, ReportUserModal.tsx, NotificationToggle.tsx, and others), confirming it is properly exported from@rocket.chat/fuselage. TypeScript compilation and component rendering would fail if the export were missing, making this concern unfounded.> Likely an incorrect or invalid review comment.apps/meteor/client/components/message/toolbar/items/actions/Timestamp/TimestampPicker/TimestampPickerModal.tsx (1)
67-67: Preview moved to the top of the form — LGTM.The reorder is clean and the rest of the form logic is untouched. This matches the PR intent.
packages/gazzodown/src/elements/Timestamp/index.tsx (1)
57-60: ⚡ Quick winVerify that
FormatSelectorexample strings and documentation reflect removal of timezone information from 'f' and 'F' style timestamps.The switch from previous timezone-aware time formats to
p(short time) andpp(shorter time) means rendered<Tag>elements in chat will no longer display UTC-offset or timezone context. Confirm that example labels inFormatSelectorand any user-facing documentation have been updated to show the new format output (e.g., no timezone suffix like "GMT+5:30"), and that this breaking change in rendered output has been communicated to stakeholders.
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
2b577ce to
063f320
Compare
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
Proposed changes (including videos or screenshots)
Fixes two bugs in the Insert Timestamp feature:
Timezone conversion reversed —
dateToISOString()copied local clock fields and appended the target timezone suffix without adjusting the hours. Fixed by computing the correct wall-clock time using UTC accessors on an offset-adjusted Date.Relative time preview stale + locale revert — The
RelativeTimecomponent only recomputed text on interval ticks (up to 1 hour delay), and the interval callback hardcodedlocale: 'en'. Fixed by adding auseEffectfor immediate updates and using the context locale in the interval.Also includes UX improvements: reordered modal fields (Preview first), updated timezone terminology, and added a hint to the timezone picker :-


Based on:

Issue(s)
Steps to test or reproduce
Further comments
SUP-1024
Summary by CodeRabbit
New Features
Improvements
Display/Formatting
Tests
Chores