Repository navigation
Fix monthly week counts for wrapped week starts - #33
Closed
sakura168899-debug wants to merge 1 commit into
Closed
sakura168899-debug wants to merge 1 commit into
sakura168899-debug wants to merge 1 commit into
Conversation
Owner
|
我是刻意这么设计的,比如要查某天位于当年的第几周,并不是简单的把每个月的周数都加起来。两个月共用一周的时候,是只算一周,用上月的最后一周或下月的第一周,其实都是同一个周。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
SolarUtil.getWeeksOfMonth()在月初的星期數小於每週起點start時,會少算一週。例如以星期一為起點,2021 年 8 月共有 6 個日曆週,但目前回傳 5。這也影響
SolarWeek.next(-1, True):從 2021 年 9 月第一週往前切換,會直接跳到 8 月第五週,漏掉 8 月 30、31 日所在的最後一週。修正
將負的週起點偏移量加上一週,與
SolarWeek.getIndex()現有處理一致。沒有更動 API、農曆換算或八字判讀規則,也沒有新增第三方依賴。驗證
python -m unittest discover -s test -p "*Test.py",244 個測試通過(本機 Python 3.12.14)。calendar為比對依據。git diff --check通過。這份修正與測試使用 AI 協助產出;以上數字來自本機實際執行,不代表上游 CI 已通過。