# Ion-datetime v6 Angular

**URL:** <https://forum.ionicframework.com/t/ion-datetime-v6-angular/223939>\
**Category:** Ionic Framework\
**Created:** [June 7, 2022, 1:41am UTC](https://forum.ionicframework.com/t/ion-datetime-v6-angular/223939 "2022-06-07T01:41:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bibble235](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bibble235/32/141700_2.png) [@bibble235](https://forum.ionicframework.com/u/bibble235)\
**Post date:** [June 7, 2022, 1:41am UTC](https://forum.ionicframework.com/t/ion-datetime-v6-angular/223939/1 "2022-06-07T01:41:50Z")

</div>

Hi,

Very new to ionic and try to follow a course which used v4.

I can get the ion-datetime to display on a button press. The original code is

```auto
            <ion-item lines="none">
              <ion-button id="open-modal">Date</ion-button>
              <ion-datetime></ion-datetime>
            </ion-item>

```

This produced a calendar all the time instead of when the button was pressed.

Looking at the docs I used

```auto
          <div class="grid-item">
            <h2>Datetime in Overlay</h2>
            <ion-button id="open-modal">Open Datetime Modal</ion-button>
            <ion-modal trigger="open-modal">
              <ion-content force-overscroll="false">
                <ion-datetime></ion-datetime>
              </ion-content>
            </ion-modal>
          </div>

```

This produced an empty modal when pressed. Reading the docs for modal and angular I added the ng-template. ie.

```auto
          <div class="grid-item">
            <h2>Datetime in Overlay</h2>
            <ion-button id="open-modal">Open Datetime Modal</ion-button>
            <ion-modal trigger="open-modal">
              <ng-template>
                <ion-content force-overscroll="false">
                  <ion-datetime></ion-datetime>
                </ion-content>
              </ng-template>
            </ion-modal>
          </div>

```

This worked as expected but the modal is just ugly.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/0/b0be86faf5003e178e2d1ce17d766cd272435e44.png)

Any help gratefully received

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [June 7, 2022, 4:33am UTC](https://forum.ionicframework.com/t/ion-datetime-v6-angular/223939/2 "2022-06-07T04:33:07Z")

</div>

Hi & welcome!

Imho this is exactly how you programmed it to be

What is the preferred design? Only the datetime tightly wrapped in an overlay? Then maybe use popover instead? See doc with example

---

<div class="post-metadata">

**Author:** ![bibble235](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bibble235/32/141700_2.png) [@bibble235](https://forum.ionicframework.com/u/bibble235)\
**Post date:** [June 7, 2022, 4:59am UTC](https://forum.ionicframework.com/t/ion-datetime-v6-angular/223939/3 "2022-06-07T04:59:07Z")

</div>

I think the problem is I viewed the source on the docs. Far better to use the code on the page. Popover did the trick.

Thanks
