Commit graph

6 commits

Author SHA1 Message Date
Amir Sarabadani
15a278189f Reorg: Move MWTimestamp to MediaWiki\Utils
Bug: T321882
Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
2023-08-19 05:53:40 +02:00
Func
040eb0f676 Move validation of timezone to HTMLTimezoneField
So that the validation can benefit all use cases.

Bug: T320296
Change-Id: Ie667fd53656d4553096691a69a68786571a49eb8
2023-01-19 22:43:59 +08:00
Tim Starling
e1041b4d7a Fix the remaining Phan failures on PHP 8.1
* Use @phan-var to suppress issues with version independence.
* In Parser strictly compare to false. I still think this is a Phan bug.

Bug: T322278
Change-Id: I654b73e5ed843474ed35c3780d95b04dce388bea
2022-11-09 13:12:50 +11:00
Tim Starling
43a93d9782 Use the null coalescing assignment operator
Available since PHP 7.4.

Automated search, manual replacement.

Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
2022-10-21 13:26:49 +11:00
Daimona Eaytoy
b6431b5caf Fix logic for formatting negative timezone offsets
As described on the task, floor() returns the closest integer to the
left, and so it's not the right choice in this case for negative
offsets.

Put the logic in a static method of the UserTimeCorrection class so that
it can be reused elsewhere without making the previous mistake, and add
tests for it.

Also update a comment in UserTimeCorrection, as a follow-up to
I99a00dff7e3319ce45883191daee16bec1ed68ba.

Bug: T318455
Change-Id: I9acc8fa278d5a58a1d56c28c9e8b3f9093f8add9
2022-09-23 22:35:11 +00:00
Daimona Eaytoy
ec09c19fba Create an HTMLForm field for selecting a timezone
This patch introduces HTMLTimezoneField, an HTMLForm field type that
allows the user to select a timezone, either from a geographic zone, by
manually entering an offset, or using the wiki/browser default. This
logic is extracted from DefaultPreferencesFactory so that it can be
reused elsewhere.

The widget itself is really just an HTMLSelectOrOtherField, it's just
the list of options and the JS logic that is special.

Bug: T309629
Change-Id: I99a00dff7e3319ce45883191daee16bec1ed68ba
2022-09-23 18:35:51 +02:00