Steps to replicate the issue (include links if applicable):
- Go to Special:Preferences#mw-prefsection-rendering-timeoffset
- In the dropdown, enter "-02:30"
- Notice that the previewed time looks good
- Save preferences
- Go back to the same section
What happens?:
The field reads "-03:30", and everything else behaves as such.
What should have happened instead?:
It should be "-02:30" as I previously set.
Other information (browser name/version, screenshots, etc.):
I noticed this while working on things related to T309629, but the bug predates that work. The reason is very simple, several places use this logic to build the offset string:
sprintf( '%+03d:%02d', floor( $offset / 60 ), abs( $offset ) % 60 )
this works well with positive offsets and negative offsets rounded to the hour. However, if the offset is something like "-150", $offset / 60 is negative, and floor() returns the closest integer at the left, in this case -3 and not -2.