Page MenuHomePhabricator

Saturate day of month in datepicker

Authored by 0 on Jun 13 2021, 9:16 PM.
Referenced Files
Unknown Object (File)
Sat, Jan 28, 5:10 PM
Unknown Object (File)
Tue, Jan 24, 2:50 PM
Unknown Object (File)
Thu, Jan 19, 12:38 PM
Unknown Object (File)
Tue, Jan 10, 8:43 AM
Unknown Object (File)
Tue, Jan 10, 8:41 AM
Unknown Object (File)
Tue, Jan 10, 8:40 AM
Unknown Object (File)
Sun, Jan 8, 6:55 PM
Unknown Object (File)
Sat, Jan 7, 4:28 AM



The datepicker could step by the wrong number of months, due to the date rolling over to the next month when the number of days in the month is exceeded. For example, going forward from January 31 would jump to March 3, while going backward from July 31 would only go to July 1.

Push the date back to ensure that the datepicker stays in the correct month when switching.

Test Plan

Changed months starting from an assortment of dates.

Diff Detail

rP Phabricator
Lint Not Applicable
Tests Not Applicable

Event Timeline

0 held this revision as a draft.
0 published this revision for review.Jun 13 2021, 9:22 PM

Wondering if you saw:

Effective June 1, 2021: Phabricator is no longer actively maintained.

I did see that, but @epriestley (or possibly an impostor) said:

I think a reasonable strategy for the moment is just to send patches upstream for review normally (with me as a reviewer) until I stop getting to them or it's clear that we don't have similar viewpoints on what constitutes a desirable patch.

(That was really me.)


In a perfect world, I think the "most correct" approach here might be to allow an internal state of "April 31", and clamp it back to "April 30" when the display or storage layers read it. With this reproduction case:

  • Select Jan 31 2020 in a date picker, open the date picker again, press Next Month, press Previous Month. You end up on:
  • Old behavior: Feb 3
  • New behavior (with this patch): Jan 28
  • "Most correct" behavior: Jan 31

This patch is a big improvement and completely correcting this is likely a headache, though, so I think this is a reasonable step forward.

This revision is now accepted and ready to land.Jun 24 2021, 5:40 PM

I added you to Blessed Committers, so you should be able to land this yourself. See that project description for guidance, or let me know if you run into issues.

This revision was automatically updated to reflect the committed changes.

Thank you! Looks like it worked.