Ionic how to create a datepicker - ionic-framework

Hello I'm new to Ionic and I'm trying to create a datepicker in an input field.Something like this:
I saw the docs from Ionic framework but they have another form and doesn't work https://ionicframework.com/docs/native/date-picker/

Here's a DateTime UI Component from Ionic. Ionic DateTime
Template Usage example
Reactive Forms
<form [formGroup]="signupForm">
<ion-datetime formControlName="signupDate"></ion-datetime>
</form>
with ngModel
<ion-datetime [(ngModel)]="signupDate"></ion-datetime>

using ionic v5 & v4 you just need to use the below template:-
<ion-item>
<ion-label>Date</ion-label>
<ion-datetime displayFormat="DD MMMM YY, HH:mm a" min="2000" max="2025">
</ion-datetime>

Related

Why date picker is not appearing when click the placeholder name?

I want to show the ionic date picker when I click string. But instead of that date picker is showing in the page without clicking anything
here is the stackBlitz
here is my code :
<ion-datetime placeholder="pick the date"></ion-datetime>
in TS file I just use above code. I wanted to see the date picker when i click the "pick the date " string
You could wrap an ion-input or ion-button in ion-datetime.
something like that:
<!-- Datetime in overlay -->
<ion-button id="open-modal">Open Datetime Modal</ion-button>
<ion-modal trigger="open-modal">
<ng-template>
<ion-content>
<ion-datetime></ion-datetime>
</ion-content>
</ng-template>
</ion-modal>
more in the documentation:
https://ionicframework.com/docs/api/datetime

Render regular HTML in IONIC

Is it possible to render regular HTML code in ionic? The reason behind is i want to render a chart, that is generated by a python code (Using Altair)
Thanks.
You can render regular html in ionic.
Let's assume you want to render the chart into an ion-item
The code goes something like this
<ion-list>
<ion-item>
<!-- Some code, you may use *ngFor to display the entire data -->
Example: <div class="exClass"><!-- May be a table -->{{ someData }}</div>
</ion-item>
</ion-list>

Using the component ion-datetime the information are displayed in two lines

I'm using IONIC framework for create an APP, but I have a little issue whit a "datetime" component the values are showed in two lines.
<ion-list-header>
<ion-label>Datos de nacimiento</ion-label>
</ion-list-header>
<ion-list>
<ion-label>Fecha de Nacimiento:</ion-label>
<ion-datetime value="{{fechaNaci | date: 'yyyy-MM-dd'}}" display-format="YYYY MMMM DD"></ion-datetime>
</ion-list>
</ion-content>```
I expect the output should be displayed on the yellow rectangle instead of green one:
[enter image description here][1]
[1]: https://i.stack.imgur.com/RLVr6.jpg
Hi I was checing the documentation about ionic and I found my issue I forget add and ion-item between ion-list and my ion-label something very simple.

is my ionic app scss an old version?

the last time I used Ionic was like a year ago. Now I create a new proyect but I realize that all teh css components of ionic had changed but if a try to use something new I cant because I think i'm using an old version.
For instance - this code, I took it from the official docs:
<button ion-button color="secondary">Secondary</button>
<button ion-button color="danger">Danger</button>
<button ion-button color="dark">Dark</button>
and they show up like plane buttons without style.
But if I write them as I used to, just works.
<button class="button button-positive">
Boton prueba 2
</button>
The thing is as Ionic changed their docs I don't have any reference now to look out so I don't have another alternative to update. Going nuts to accomplish this.
Thanks

Ionic ion-input tag not rendering

In my ionic app, the ion-input simply not render and I don't discovered why, yet.
For example, this code not render:
<ion-item>
<ion-label color="primary" floating>Floating Label</ion-label>
<ion-input type="text"></ion-input>
</ion-item>
Just the Floating Label appears, but the input effect not works and I cannot type anything.
What am I forgetting?
And more, the input style using the input tag is in bold, and in my own css am not changing the default style.
I am also facing same issue. After googling, came to know this not work in Ionic 1. Ionic version 1 will not support ion-iput. This is supporting from Ionic 1 later versions like ionic 2,etc.
I think that you did not create an Ionic2 application !