Repository navigation
Fix plan slot durations and split-state rendering - #5
Conversation
|
Hi @graememorgan, thanks a lot for this, nice work!
Predbat writes I tested a slot that splits
UK users would also lose it every summer during BST. The slot's start time needs to be taken in Predbat local clock, for example from the row's own time text, rather than UTC.
Thanks again! Let me know how do you want to approach it. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9uQsk9nL8y1oWtoymkVUq
|
Ah, I meant to reply! Thanks for the detailed review. :) That timezone issue is vexing. It's a shame JS doesn't have any super-easy-to-use libraries for civil time calculations. I've used Temporal for it in the past, and would not describe it as easy. |
|
Thank you Sir! New version has just been released. Full credit to You for this one. |
I noticed that some slots which should occupy the full 30 minutes were occasionally being shortened to 20 minutes or so. This happened when a short initial slot caused the card to infer an incorrect slot duration. This PR fixes the issue by using the start time of the next slot as the end time, rather than relying on that inference (except for the final slot, which still requires some guesswork).
I've also added better support for split-state slots. Where Predbat provides an explicit transition time, the card uses it. Where a slot contains both charging and exporting without a specified transition time, it's displayed as a hatched region rather than assuming an arbitrary division: