Skip to content

fix(datetime-button): time-only values are parsed - #26852

Merged
liamdebeasi merged 6 commits into
mainfrom
FW-3552
Mar 2, 2023
Merged

fix(datetime-button): time-only values are parsed#26852
liamdebeasi merged 6 commits into
mainfrom
FW-3552

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Feb 24, 2023

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: resolves #26851

ECMAScript uses a simplified ISO 8601 format that does not allow for time-only values (i.e. 22:40). As a result, developers received an Invalid Date error when setting value="22:40" (or similar time-only value). However, Ionic does allow for passing time-only values so we need to account for this.

What is the new behavior?

  • Updated the getLocalizedTime function to always have associated date values. These values do not impact the result of this function since Intl.DateTimeFormat only looks at the hour/minute values.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Feb 24, 2023
@liamdebeasi
liamdebeasi marked this pull request as ready for review February 24, 2023 14:58
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.

bug: ion-datetime-button doesn't work with time only value (value="22:20") (ion-datetime works OK with time only value)

3 participants