Page MenuHomePhabricator

Saturate day of month in datepicker
ClosedPublic

Authored by 0 on Jun 13 2021, 9:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 19, 12:12 PM
Unknown Object (File)
Mon, Nov 18, 3:57 AM
Unknown Object (File)
Thu, Oct 24, 11:29 PM
Unknown Object (File)
Thu, Oct 24, 11:15 PM
Unknown Object (File)
Oct 8 2024, 6:46 PM
Unknown Object (File)
Oct 8 2024, 6:45 PM
Unknown Object (File)
Oct 8 2024, 6:45 PM
Unknown Object (File)
Oct 8 2024, 6:23 PM
Subscribers

Details

Summary

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

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
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.)

Thanks!

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.