feat: decoupling datetime picker from ion-datetime input
See original GitHub issueFeature Request
Ionic version: [x] 4.x
Describe the Feature Request Currently it is only possible to use a datetime picker with a ion-datetime input field. The generation of a datetime picker is binded to this component.
This feature request is about decoupling the logic from the ion-datetime component and move it to a separate controller, e.g. ion-datetime-picker-controller.
This would make it possible to open a datetime picker without a input element (currently only possible with a hidden DOM element). Another benefit of pulling out logic from this component is its size (~670 locs).
Describe Preferred Solution
- a new controller which can create datetime picker instances
Describe Alternatives
- alternatively expose methods to create datetime picker cleverly from ion-datetime input component
Related Code pseudo code
const dateTimeController = document.querySelector('ion-datetime-picker-controller');
const picker = await dateTimeController.create({
value: new Date(),
buttons: [
{
text: 'Cancel',
role: 'cancel'
},
{
text: 'Confirm',
handler: (value) => {
console.log(`Got Value ${value}`);
}
}
]
});
await picker.present();
Additional Context
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:14 (3 by maintainers)
Top Results From Across the Web
feat: decoupling datetime picker from ion-datetime input ...
This feature request is about decoupling the logic from the ion-datetime component and move it to a separate controller, e.g. ion-datetime- ...
Read more >ion-datetime - Ionic Framework
Datetimes present a picker interface to select dates and times. Ionic's API Datetime input component easily displays a preferred format, and manages values....
Read more >Ionic 5 Date and Time Input Sample App - Appery.io
Sample app demonstrating Date and Time Input in Ionic 5. ... Custom picker Using ion2-calendar module for single date picking 4. Custom picker...
Read more >Date picker popup in Ionic 6 | Damir's Corner
To make the ion-datetime component appear in a popup, place it inside the ion-popover component. To display the selected date on the page,...
Read more >ion-datetime always forces the date picker to be displayed
Try like this <ion-datetime presentation="time" displayFormat="h:mm" locale="en-US"></ion-datetime>. ion-datetime will use the hour cycle ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello!
It would be great use ion-picker like a component. Like this:
You are referring to being able to use ion-datetime inline like this, correct?