question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: decoupling datetime picker from ion-datetime input

See original GitHub issue

Feature 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:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
nicobytescommented, Mar 25, 2020

Hello!

It would be great use ion-picker like a component. Like this:

Group 1

8reactions
liamdebeasicommented, Oct 14, 2019

You are referring to being able to use ion-datetime inline like this, correct?

IMG_6269

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found