Repository navigation
Conversation
…picker Confirming a selection with no initial value emitted a full timestamp (e.g. 2026-09-01T16:19:00) where the time was the device clock when the component loaded. The default parts now drop the time fields for presentations that do not render a time picker, so the emitted value matches the date-only format already used when a date-only value is passed. BREAKING CHANGE: ion-datetime now emits date-only values for the date, month, year, and month-year presentations when confirming a selection without an initial value. Applications relying on the time portion should use the date-time or time-date presentations.
|
@Goldloli is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #31600
What is the current behavior?
Confirming a selection in
<ion-datetime presentation="date">with no initialvalueemits a full timestamp such as2026-09-01T16:19:00, where the time is whatever the device clock showed when the component initialised.This happens because
defaultPartsis derived fromparseDate(getToday()), which carrieshour/minute, andconvertDataToISO()appendsT${hour}:${minute}:00wheneverhour !== undefined, regardless of the presentation.What is the new behavior?
hour,minute,ampm) for presentations that do not render a time picker (date,month,year,month-year).YYYY-MM-DDfor those presentations, matching the format already emitted today when a date-onlyvalueis passed (the round-trip behavior confirmed in the issue).time,date-time, andtime-dateare unchanged.removeTimePartshelper was added toutils/manipulation.tsand applied wheredefaultPartsis computed indatetime.tsx.Does this introduce a breaking change?
Applications that relied on the time portion of values emitted by
date,month,year, ormonth-yearpresentations without an initial value will now receive a date-only string. This aligns with the note in #31600 that changing what an empty datetime returns is a behavioral change tracked for a major release, so this PR targetsnextand updatesBREAKING.mdaccordingly. Applications that need the time portion should use thedate-timeortime-datepresentations.Other information
nextwithout this change, the new test receives2026-10-10T01:42:00(the local clock at run time); with this change it receives2026-10-10.npx stencil test --spec --max-workers=2 src/components/datetime: 10 suites, 124 tests passed.npx playwright test src/components/datetime/test/basic/datetime.e2e.ts(Mobile Chrome + Mobile Safari projects): 153 passed, 1 skipped, including two new tests covering the date-only emission and adate-timeguard test asserting the full timestamp is preserved. The Mobile Firefox project could not be launched on this machine (local Playwright Firefox install issue, unrelated to this change) and is covered by CI.darwinbaselines for the screenshot tests rather than comparing against the committed ones. The change only removes time fields from the default parts and the full existing spec suite above passes, but visual verification against the committed baselines is left to CI.