Skip to content

fix(room-kit): show 12 PM and 12 AM correctly in chat message time - #1711

Open
RaphaelFakhri wants to merge 1 commit into
100mslive:mainfrom
RaphaelFakhri:fix/chat-time-12-hour-format
Open

RaphaelFakhri wants to merge 1 commit into
100mslive:mainfrom
RaphaelFakhri:fix/chat-time-12-hour-format

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Description

Chat messages show the wrong time for hours 12 to 12:59. getTimeStringin12HourFormat chooses the notation with hours / 12 > 1, which is false for 12, and it maps hour 0 and hour 12 to 00. A message sent at 12:30 in the afternoon renders as 00:30 AM, and a message sent at 00:05 renders as 00:05 AM instead of 12:05 AM.

This change uses hours >= 12 for the PM notation and hours % 12 || 12 for the displayed hour. It also configures the package's Jest transform to use @react-native/babel-preset, because metro-react-native-babel-preset from babel.config.js is not installed in this package, so yarn test cannot run any test today.

Test command: cd packages/react-native-room-kit && npx jest src/utils/functions.time.test.tsx

Fixes #1709


Additional context

Without the source change, the new test fails 3 of 7 cases (00:05, 12:00 and 12:30). With the change, all 7 pass.

Pre-launch Checklist

  • The Documentation is updated accordingly, or this PR doesn't require it.
  • I have updated the ExampleAppChangelog.txt file with relevant changes.
  • I updated/added relevant documentation (doc comments with ///).
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@RaphaelFakhri
RaphaelFakhri requested a review from ygit as a code owner September 29, 2026 14:35
@trunk-io

trunk-io Bot commented Sep 29, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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.

Chat message time shows "00:30 AM" for 12:30 PM

1 participant