cancel
Showing results for 
Search instead for 
Did you mean: 

SAP UI5 - Date Picker - Special Date

harshita_chaubey
Explorer
0 Kudos
1,348

Hello Experts,

Can you please provide any example how to add special date (specialDates aggregation) to datepicker control?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

sergei-u-niq
Active Contributor
0 Kudos

Hi Harshita, here is a nice example:

https://sapui5.hana.ondemand.com/#/entity/sap.ui.unified.Calendar/sample/sap.ui.unified.sample.Calen...

please note that sap.m.DatePicker uses sap.ui.unified.Calendar for rendering the actual date selection dialog.

Sergei

harshita_chaubey
Explorer
0 Kudos

Thanks Sergei. Tried it and it works fine.

One question though, do you have any idea if we can enable any specific date out of the range we already set (min and max date) in the datepicker.

Like for example, minDate="11th Nov" maxDate="30th Nov", but I also have to enable single date i.e. 7th Nov in the date picker.

sergei-u-niq
Active Contributor
0 Kudos

you can't enable a date outside the min/max range, as far as I know (never tried), but you can disable dates within the min/max range. E.g.

https://sapui5.hana.ondemand.com/#/entity/sap.ui.unified.Calendar/sample/sap.ui.unified.sample.Calen... (scroll to January 2016)

So you could set min = 7th November, max= 30th November, and disable 8th to 10th November in your example.

Unfortunately, disabledDate is not available on the DatePicker control. You could post a feature request to SAP for that, or directly use CalendarControl instead of m.DatePicker (depends on your use case)

Answers (0)