Skip to content

fix(datetime): passing min/max no longer errors on missing date information - #25836

Merged
liamdebeasi merged 14 commits into
FW-2145from
datetime-bound-full
Aug 30, 2022
Merged

fix(datetime): passing min/max no longer errors on missing date information#25836
liamdebeasi merged 14 commits into
FW-2145from
datetime-bound-full

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Aug 26, 2022

Copy link
Copy Markdown
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue URL: N/A

When fixing #25833, the author reported another bug where they would get RangeError: Invalid time value at getDayColumnData when setting max="2012".

The problem is that when we clamp the date to use inside of ion-datetime, we simply return the user provided min/max datetime parts:

This means that if developers pass min="2012", then the minParts object will have no information for month, day, hour, or minute.

What is the new behavior?

  • Updated the min/max process logic to fill in any missing information.
  • The min parts will fill in data for January 1st at 00:00. User specified data will override as available. For example, if you passed min="2012-10" you would get a min parts object for October 1, 2012 at 00:00.
  • The max parts will fill in data for December 31st at 23:59. User specified data will override as available. For example, if you passed max="2022-05, you would get a max parts object for May 31, 2022 at 23:59.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions Bot added the package: core @ionic/core package label Aug 26, 2022
@liamdebeasi
liamdebeasi changed the base branch from main to FW-2145 August 26, 2022 18:04
@liamdebeasi liamdebeasi changed the title Datetime bound full fix(datetime): passing min/max data no longer errors on missing date information Aug 26, 2022
@liamdebeasi liamdebeasi changed the title fix(datetime): passing min/max data no longer errors on missing date information fix(datetime): passing min/max no longer errors on missing date information Aug 26, 2022
@liamdebeasi
liamdebeasi marked this pull request as ready for review August 26, 2022 18:43
@liamdebeasi
liamdebeasi requested a review from a team August 26, 2022 18:43
Comment thread core/src/components/datetime/datetime.tsx Outdated
@liamdebeasi
liamdebeasi merged commit e5f0afe into FW-2145 Aug 30, 2022
@liamdebeasi
liamdebeasi deleted the datetime-bound-full branch August 30, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants