Skip to content

fix: correct relative time format for yesterday#1594

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0509-fix-issue-359117
May 11, 2026
Merged

fix: correct relative time format for yesterday#1594
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0509-fix-issue-359117

Conversation

@MyLeeJiEun
Copy link
Copy Markdown
Contributor

@MyLeeJiEun MyLeeJiEun commented May 11, 2026

  1. Use UDAT_ABSOLUTE_DAY instead of UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS
  2. Remove the redundant numeric argument that was passed to formatter->format()
  3. Ensure the ICU API call matches the correct overload for absolute day formatting

Log: Fix yesterday's relative time formatting by using correct ICU API arguments

fix: 修复"昨天"相对时间格式错误

  1. 使用 UDAT_ABSOLUTE_DAY 替换 UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS
  2. 移除传递给 formatter->format() 的多余数值参数
  3. 确保 ICU API 调用匹配绝对日期格式的正确重载

Log: 修复昨天相对时间格式化问题,使用正确的 ICU API 参数
PMS: BUG-359117

Summary by Sourcery

Bug Fixes:

  • Correct yesterday relative time formatting by using the absolute day ICU formatter overload instead of a relative days formatter with a numeric argument.

@deepin-ci-robot
Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR. 😃

@deepin-ci-robot
Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts ICU relative time formatting for the "yesterday" case by switching to absolute-day formatting and aligning the formatter call with the correct overload, removing an unnecessary numeric argument.

File-Level Changes

Change Details Files
Fix ICU relative time formatting for the “yesterday” case by using absolute-day formatting instead of a relative offset and aligning the formatter call with the proper overload.
  • Replace the relative-day formatting call that passed an explicit offset of 1 day with an absolute-day formatting call using UDAT_ABSOLUTE_DAY.
  • Adjust the formatter->format() call signature to take only direction and unit parameters, ensuring it matches the intended ICU overload.
  • Remove the now-unneeded numeric argument previously used to specify the day offset in the formatter call for the yesterday branch.
panels/notification/common/notifyentity.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Since this path now relies on UDAT_ABSOLUTE_DAY, consider adding a short comment explaining why UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS was incorrect here and why UDAT_ABSOLUTE_DAY is required, to help future maintainers understand the semantic difference.
  • Double-check other branches of formatRelativeTime (e.g., for today/tomorrow) to ensure they consistently use the appropriate ICU absolute vs relative units so that behavior doesn’t diverge subtly between similar cases.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since this path now relies on `UDAT_ABSOLUTE_DAY`, consider adding a short comment explaining why `UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS` was incorrect here and why `UDAT_ABSOLUTE_DAY` is required, to help future maintainers understand the semantic difference.
- Double-check other branches of `formatRelativeTime` (e.g., for today/tomorrow) to ensure they consistently use the appropriate ICU absolute vs relative units so that behavior doesn’t diverge subtly between similar cases.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Use UDAT_ABSOLUTE_DAY instead of UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS
2. Remove the redundant numeric argument that was passed to formatter->format()
3. Ensure the ICU API call matches the correct overload for absolute day formatting

Log: Fix yesterday's relative time formatting by using correct ICU API arguments

fix: 修复"昨天"相对时间格式错误

1. 使用 UDAT_ABSOLUTE_DAY 替换 UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS
2. 移除传递给 formatter->format() 的多余数值参数
3. 确保 ICU API 调用匹配绝对日期格式的正确重载

Log: 修复昨天相对时间格式化问题,使用正确的 ICU API 参数
PMS: BUG-359117
@mhduiy mhduiy force-pushed the fork-from-master-0509-fix-issue-359117 branch from 8d31e9c to 2ca16c2 Compare May 11, 2026 03:37
@MyLeeJiEun
Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 11, 2026

This pr cannot be merged! (status: blocked)

@mhduiy
Copy link
Copy Markdown
Contributor

mhduiy commented May 11, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented May 11, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 18ef378 into linuxdeepin:master May 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants