Skip to content

[Chore/Refactor] Use centralized naive_utc_now for UTC datetime operations#24352

Merged
laipz8200 merged 3 commits intomainfrom
refactor/native-utc
Aug 22, 2025
Merged

[Chore/Refactor] Use centralized naive_utc_now for UTC datetime operations#24352
laipz8200 merged 3 commits intomainfrom
refactor/native-utc

Conversation

@laipz8200
Copy link
Copy Markdown
Member

Summary

  • Replace inline datetime.now(tz=UTC).replace(tzinfo=None) with centralized naive_utc_now() utility
  • Import naive_utc_now from libs.datetime_utils module
  • Remove unused datetime imports

Related Issue

Closes #24351

Test Plan

  • Code changes are covered by existing tests
  • No functional changes, only refactoring for consistency
  • Verified the naive_utc_now() function returns the same result as the replaced pattern

Replace direct datetime.now(tz=UTC).replace(tzinfo=None) pattern with
the centralized naive_utc_now() utility function from libs.datetime_utils
for better consistency and maintainability.

Closes #24351
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 22, 2025
hjlarry
hjlarry previously approved these changes Aug 22, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 22, 2025
@laipz8200 laipz8200 marked this pull request as draft August 22, 2025 13:45
Signed-off-by: -LAN- <laipz8200@outlook.com>
QuantumGhost
QuantumGhost previously approved these changes Aug 22, 2025
Copy link
Copy Markdown
Contributor

@QuantumGhost QuantumGhost left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: -LAN- <laipz8200@outlook.com>
@laipz8200 laipz8200 marked this pull request as ready for review August 22, 2025 15:52
@laipz8200 laipz8200 requested a review from QuantumGhost August 22, 2025 15:52
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 22, 2025
@laipz8200 laipz8200 merged commit da9af7b into main Aug 22, 2025
10 checks passed
@laipz8200 laipz8200 deleted the refactor/native-utc branch August 22, 2025 15:53
qiaofenlin pushed a commit to qiaofenlin/dify that referenced this pull request Aug 24, 2025
@lyzno1 lyzno1 mentioned this pull request Aug 25, 2025
qiqizjl pushed a commit to qiqizjl/dify that referenced this pull request Aug 27, 2025
HarryReidx pushed a commit to HarryReidx/dify that referenced this pull request Sep 1, 2025
…tions (langgenius#24352)

Signed-off-by: -LAN- <laipz8200@outlook.com>
(cherry picked from commit da9af7b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore/Refactor] Use centralized naive_utc_now for UTC datetime operations

3 participants