-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: An empty ion-datetime value gives a default date of May 2021 #29669
Closed
3 tasks done
mpaland opened this issue
Jun 27, 2024
· 1 comment
· Fixed by #29839 · May be fixed by l00pinfinity/devvscape-code-humor#71
Closed
3 tasks done
bug: An empty ion-datetime value gives a default date of May 2021 #29669
mpaland opened this issue
Jun 27, 2024
· 1 comment
· Fixed by #29839 · May be fixed by l00pinfinity/devvscape-code-humor#71
Labels
Comments
brandyscarney
added
package: core
@ionic/core package
type: bug
a confirmed bug report
labels
Sep 5, 2024
brandyscarney
added a commit
that referenced
this issue
Sep 5, 2024
2 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 6, 2024
…tring (#29839) Issue number: resolves #29669 --------- ## What is the current behavior? Setting `value` to an empty string on `<ion-datetime>` renders a May 2021 calendar: ```html <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 - [x] No ## Other information This can be tested by removing my fix in `datetime.tsx` and running the e2e test for Datetime: ```bash 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. --------- Co-authored-by: Tanner Reits <47483144+tanner-reits@users.noreply.github.com>
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Prerequisites
Ionic Framework Version
v8.x
Current Behavior
Using Ionic/Vue 8.2.3,
when
src.txt
is an empty string, the default date is "May 2021", no day selected.Expected Behavior
I would recommend, to set the default month, year to the actual date (in the moment like "June 2024").
Steps to Reproduce
Open an
ion-datetime
control with an empty string as value.Code Reproduction URL
https://stackblitz.com/edit/lhlzcu?file=src%2Fcomponents%2FExample.vue
Ionic Info
Ionic:
Ionic CLI : 7.2.0 (C:\Users\Marco\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/vue 8.2.3
Capacitor:
Capacitor CLI : 6.1.0
@capacitor/android : not installed
@capacitor/core : 6.1.0
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 2.0.1
System:
NodeJS : v20.11.0 (D:\nodejs\node.exe)
npm : 10.8.1
OS : Windows 10
Additional Information
No response
The text was updated successfully, but these errors were encountered: