Page MenuHomePhabricator

Change year range shown in date selection popup
Closed, ResolvedPublic

Description

from:
https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2023/Miscellaneous/Change_year_range_shown_in_date_selection_popup

Problem: In the Date selection popup, e.g. on the User contributions page after "To date:", if clicking Up Up (^ then ^), the list of years is the current and next decades (2020 to 2039). The next decade is unlikely to be required.
Proposed solution: Please change the range of years displayed to the previous and current decades.
Who would benefit: Users looking for contributions at dates earlier than 2020.

Event Timeline

Change 906762 had a related patch set uploaded (by Jsn.sherman; author: Jsn.sherman):

[mediawiki/core@master] Special:Contributions: show previous decade in date selection popup

https://gerrit.wikimedia.org/r/906762

In this case I:

  • added a max date of today to the 'end' date field for this page
  • passed that value from the input widget to the calendar widget
  • added max and min config to the calendar widget

My thinking for adding this config was that if I changed the behavior of the calendar widget across the board, it might upset some unknown-to-me workflow involving picking future dates.

It occurs to me that the calendar widget could have a style added for out of range dates when there is validation set for the input field. I actually have that partially implemented locally, but thought I should look into that as a separate task since it's out of scope.

Another possible way of handling this would be to simply stop aligning the years to the decade and just offer years surrounding the current year. That's not what was wished for though, and I'm not really sure why it works the way it does right now, so I'm leaving the default behavior alone.

jsn.sherman changed the task status from Open to In Progress.Apr 8 2023, 2:35 AM

I looked at trying to correct the 'max' date configured for a date field in php to the local timezone of the user in javascript. I did not find an obvious way to do it.

So I updated my patch to have a 'prev' & 'next' configuration choices for the 'duodecade' set of 20 years available in the date picker of the calendar and modified the user contributions js to set that value directly in the calendar widget attached to the date input widget.

Test wiki created on Patch demo by JSherman (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/18a1cf7032/w

Test wiki on Patch demo by JSherman (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/18a1cf7032/w/

(I created a new demo with the latest version of the patch.)

Change 906762 merged by jenkins-bot:

[mediawiki/core@master] CalendarWidget: year picker update

https://gerrit.wikimedia.org/r/906762

For Tech News, do you have recommended text for the entry? I imagine something like:

The date-selection menu on pages such as Special:Contributions will now show year-ranges that are in the past instead of in the future. This feature request was voted #145 in the 2023 Community Wishlist Survey. [1]

Please correct or confirm that.

It will still show years in the future, but only up through the current decade. It will also show the previous decade. (Eg. 2010 - 2029)

Before this change, it was showing the current and next decades (eg. 2020-2039).

Test wiki on Patch demo by Matma Rex using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/241f404bbe/w/