Skip to content
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

fix(datetime): display today's date and time when value is an empty string #29839

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

brandyscarney
Copy link
Member

@brandyscarney brandyscarney commented Sep 5, 2024

Issue number: resolves #29669


What is the current behavior?

Setting value to an empty string on <ion-datetime> renders a May 2021 calendar:

<ion-datetime value=""></ion-datetime>

What is the new behavior?

Show the month and time for today's date when value is an empty string. This matches how a native input with type="datetime-local" works.

Does this introduce a breaking change?

  • Yes
  • No

Other information

This can be tested by removing my fix in datetime.tsx and running the e2e test for Datetime:

npm run test.e2e src/components/datetime/test/basic/datetime.e2e.ts

The should display today's date and time when value is an empty string test should fail.

Alternatively, you can add a datetime with value="" and see the calendar before & after my fix.

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2024 2:43pm

@brandyscarney brandyscarney marked this pull request as ready for review September 5, 2024 20:56
@brandyscarney brandyscarney requested a review from a team as a code owner September 5, 2024 20:56
@brandyscarney brandyscarney requested review from gnbm and tanner-reits and removed request for gnbm September 5, 2024 20:56
Copy link
Member

@tanner-reits tanner-reits left a comment

Choose a reason for hiding this comment

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

One suggestion, otherwise looks good!

core/src/components/datetime/datetime.tsx Outdated Show resolved Hide resolved
@brandyscarney brandyscarney added this pull request to the merge queue Sep 6, 2024
Merged via the queue into main with commit f1d50c0 Sep 6, 2024
48 checks passed
@brandyscarney brandyscarney deleted the ROU-11158 branch September 6, 2024 16: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.

bug: An empty ion-datetime value gives a default date of May 2021
2 participants