Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49185

Ionic date picker customization

$
0
0

Hi,

I am working on an application, where I want to set a date. I am using ionic date picker to show date dialog.

My query is when I scroll the date past maximum date for that month then it jumps to next month, but I want to keep month as it is unless user changes otherwise only the date should keep on rolling back to 1st.

As per attached screenshot, when I change the date from 31 to 1 then Month gets changed to Feb, but I want month to be Jan only.

My code snippet,

showNativeDatePicker() {

    this.beforeClick.emit();

    this.datePicker.show({

      date: this.value ? new Date(this.value) : new Date(),

      mode: 'date',

      androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_LIGHT,

      minDate: new Date(this.minDate).getTime() || '',

      maxDate: new Date(this.maxDate).getTime() || '',

      allowOldDates: false

    }).then(

      (date: Date) => {

        const d = this.datePipe.transform(date, 'yyyy-MM-dd');

        this.value = d;

        this.onClick.emit(d);

      },

      err => console.log(err)

    );

  }

Any suggestions/pointers will be much appreciated.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 49185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>