schizophrenicmaniac opened a new pull request, #21832:
URL: https://github.com/apache/echarts/pull/21832

   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   ### What does this PR do?
   
   Keeps time axis day ticks at the local start of each day after a DST change 
at midnight, and labels them as days.
   
   ### Fixed issues
   
   - #21824: Time axis day ticks shift to 01:00 and get hour labels after a 
midnight DST change
   
   ## Details
   
   ### Before: What was the problem?
   
   In a time zone where local midnight is skipped, such as Atlantic/Azores on 
2026-03-29, `addTicksInSpan` steps the day ticks with `setDate` on a single 
`Date`. Once that day starts at 01:00, every later day tick in the month stays 
at 01:00, and there is an extra tick at Apr 01 01:00. The label unit came from 
`getUnitFromValue`, which sees 01:00 and treats those ticks as hours, so they 
were labelled "01:00" instead of the day number.
   
   ### After: How does it behave after the fixing?
   
   Day steps now reset the hour to 0 after `setDate`. Mar 29 still gets 01:00 
because 00:00 doesn't exist that day, and the following days go back to 00:00. 
Each tick's unit is now the coarser of the value-based unit and the unit of the 
level it belongs to, so a day tick at 01:00 is still labelled as a day and 
month boundaries keep their month label. For the example in the issue, the 
labels are now "27", "28", "29", "30", "31", "{primary|Apr}", "2", "3", with no 
tick at Apr 01 01:00.
   
   I added a unit test in test/ut/spec/scale/time.test.ts that runs in 
Atlantic/Azores. Jest gives each test file its own copy of `process.env`, so 
setting `TZ` there doesn't affect `Date`, and a `@jest-environment` comment 
would have to come before the license header. So the unit tests now use a small 
jsdom environment (test/ut/core/environment.js). It adds a `setTimezone()` 
helper that sets `TZ` on the real process and puts the original time zone back 
when the test file finishes.
   
   ## Document Info
   
   One of the following should be checked.
   
   - [x] This PR doesn't relate to document changes
   - [ ] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   ## Misc
   
   ### Security Checking
   
   - [ ] This PR uses security-sensitive Web APIs.
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   test/ut/spec/scale/time.test.ts
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   
   Fixes #21824


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to