Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 141
    • Merge requests 141
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !2064

Merged
Created Feb 20, 2025 by Xiaowu Zhang@xiaowu.zhangDeveloper

handle correctly addToDate when add/remove month

  • Overview 4
  • Commits 1
  • Pipelines 2
  • Changes 2

after https://lab.nexedi.com/nexedi/erp5/-/merge_requests/1768, addToDate start to have strange behavior

  
march_31 = DateTime('2001/03/31')

print(addToDate(march_31, month=1, day=1))
2001/05/01 00:00:00 UTC  ✔️
print(addToDate(march_31, month=1, hour=24))
2001/04/30 00:00:00 UTC  ❌
print(addToDate(march_31, hour=24))
2001/03/31 00:00:00 UTC  ❌
print(addToDate(march_31, month=-1, day=-1))
2001/02/27 00:00:00 UTC  ✔️
print(addToDate(march_31, month=-1, hour=-24))
2001/02/28 00:00:00 UTC  ❌

the propose of this MR is to fix it

Edited Feb 24, 2025 by Xiaowu Zhang
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: feature
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7