Skip to content

DEV: use the only source for time shortcut options on all date pickers #16366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

AndrewPrigorshnev
Copy link
Contributor

@AndrewPrigorshnev AndrewPrigorshnev commented Apr 4, 2022

Some time ago, we added a new time-shortcut-picker. That picker had more customizable API than the old future-date-input and used a new builder of time shortcut options. Then we were going to switch future-date-input to the new options builder and make its API looks like the API of time-shortcut-picker, which would make it much more customizable. I did that change in #12985, but that PR was closed without merging due to various reasons (PR was too big, had flaky specs and was opened just before a release and then got outdated).

Now I'm doing this job again, this time in two steps to make it safer and easier to review. The steps are

  1. Make all our date-pickers use the only one set of time shortcut options (this is made in this PR)
  2. Make API of future-date-input looks like API of the time-shortcut-picker(this will be provided in the next PR)

Note that still there is some duplication in code, I'm going to dry the code up more on the second step.

Note also that I haven't added many tests in this PR because tests that're needed for covering this change were already added before, mostly in #13836.

Also, the time shortcut options in the old set weren't timezone aware:

so, probably we had some subtle timezone-related bugs which will be fixed by this PR.

@AndrewPrigorshnev AndrewPrigorshnev force-pushed the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch 11 times, most recently from 4c0e316 to 73f2d38 Compare April 11, 2022 09:59
@AndrewPrigorshnev AndrewPrigorshnev marked this pull request as ready for review April 11, 2022 10:50
@AndrewPrigorshnev AndrewPrigorshnev force-pushed the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch from 73f2d38 to e767b07 Compare April 17, 2022 10:14
Copy link
Contributor

@martin-brennan martin-brennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks like a great cleanup, and as you said you've tested all this manually. Thanks for doing this work, much appreciated 🙏

@AndrewPrigorshnev AndrewPrigorshnev force-pushed the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch from e767b07 to 003afe7 Compare April 20, 2022 10:11

_date: null,
_time: null,

init() {
this._super(...arguments);
this.userTimezone = this.currentUser.resolvedTimezone(this.currentUser);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API looks a bit weird. Why is resolvedTimezone on the currentUser object? Shouldn't it be a helper method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is weird. It's not the first call, see #15749 (comment). I'll fix it in a separate PR in next days.

@AndrewPrigorshnev AndrewPrigorshnev force-pushed the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch from 003afe7 to 65a1f38 Compare April 21, 2022 09:21
@AndrewPrigorshnev AndrewPrigorshnev force-pushed the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch from 65a1f38 to 9b5e5f1 Compare April 21, 2022 11:24
@AndrewPrigorshnev AndrewPrigorshnev merged commit 42bb629 into main Apr 21, 2022
@AndrewPrigorshnev AndrewPrigorshnev deleted the dev/use-the-only-source-for-time-shortcut-options-on-date-pickers branch April 21, 2022 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants