This is to parity the global PHP function wfIsInfinity(). In our JavaScript, especially around watchlisting, we use both infinity and infinite (and sometimes other strings) as infinity values, depending on if we're talking about the Expiring-Watchlist-Items dropdown (which uses infinite) or API interaction (which more commonly uses infinity).
We need a Core stable method to test if a string is infinity, such that we don't need to worry about which context the value is coming from.
This will be especially useful for the work that is going into T265716: Allow users to set their default watchlist item expiry time.
Justification for putting in mw.util
- It doesn't fit soundly in any other singular module, and is used by multiple other modules
- It's a very tiny string comparison (small footprint)
- It could and probably should become widely used, i.e. in gadgets and scripts that work with expiries
Acceptance criteria
- mw.util.isInfinity() should return true for the same values as MediaWiki's ExpiryDef::INFINITY_VALS, which includes: infinite, indefinite, infinity, never
- Inject the ExpiryDef::INFINITY_VALS into the JS, so that we still have one list of values to maintain.