Page MenuHomePhabricator

Block time estimate math looks incorrect
Open, Needs TriagePublic


Possibly as a result of T130441, on enwiki I see a block entry made at "16:41, 8 April 2016" that is listed to last "1 decade, 3 years, 364 days, 20 hours, 20 minutes and 24 seconds", but when I go to change the block I see the block expiry is "Mon, 08 Apr 2030 16:41:20 GMT".

Logically, at least, it looks like that should say "14 years".

Event Timeline

lfaraone created this task.Apr 8 2016, 8:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 8 2016, 8:26 PM
Umherirrender added a subscriber: Umherirrender.EditedApr 8 2016, 9:32 PM

Language::formatDuration is handling leap years by using a value for a year with 365,2425 days to build the intervals.

A duration of 14 years from now (2016 to 2030)) results in 3 leap years (2020, 2024, 2028), but the function is using 3,395 leap years.
Using just 365 for the intervals would result in "1 decade, 4 years and 3 days", which sounds better, but is also not exactly correct.

This just effects the displayed duration inside the log. The expiry of the block is calculated correctly. This can be confirmed by looking at Special:BlockList