473
Views
13
Comments
Solved
[OutSystems UI] Updated Date Picker
outsystems-ui
Reactive icon
Forge asset by OutSystems

Hello Community,

With the updated date picker, i dont see any disabled days option anymore

Can somebody help me weather its removed or is there any workaround?


Thanks,

Krunal

2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Krunal,

To notify the OutSystems team about the mentioned configuration limitation in the updated datepicker widget, I'm tagging the OutSystemsUI to this post.

However, I do have a workaround to suggest for your use case.

Implementation Steps:

  • Define the DatePicker OnInitialize handler 
  • Define a JS node with the below JavaScript in the DatePicker OnInitialize handler flow
  • Pass the array of date which needs to be disabled
  • Defined weekends function in the JS snippet will take care of disabling the weekend days

JavaScript Snippet:

function toISODate(d) {
    var z = function(n) {return ('0' + n).slice(-2);};
    return d.getFullYear() + '-' + z(d.getMonth()+1) + '-' + z(d.getDate()); 
}

function specificDays(date) {
    var rdatedData = JSON.parse($parameters.SpecificDays);
    return rdatedData.includes (toISODate(date));
}

function weekends(date) {
    return (date.getDay() === 0 || date.getDay() === 6);
}

var dataPickerProvider = OutSystems.OSUI.Patterns.DatePickerAPI.GetDatePickerItemById($parameters.DatePickerWidgetId)._provider;
dataPickerProvider.config._disable = [weekends, specificDays];
dataPickerProvider.clear();

Demo Screen: DisableDays_DatepickerTask

Refer to the attached oml

Refer to the FlatPickr Documentation: #disabling-dates-by-a-function

I hope this helps you!


Kind regards,

Benjith Sam

Sparkle_DisableDays_DatePicker_Task.oml
2021-08-12 05-19-40
Shubham Janbandhu

Hi Krunal,

It is there.

Are you looking for MinDate()

Thanks,

Shubham

2021-07-14 10-21-07
Krunal Vyas

Hello Shubham,

No, I want to pass a list of dates which i want to diable as well as weekends i want to disable.

Old date picker used to have those options directly available


Thanks,

Krunal

2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Krunal,

To notify the OutSystems team about the mentioned configuration limitation in the updated datepicker widget, I'm tagging the OutSystemsUI to this post.

However, I do have a workaround to suggest for your use case.

Implementation Steps:

  • Define the DatePicker OnInitialize handler 
  • Define a JS node with the below JavaScript in the DatePicker OnInitialize handler flow
  • Pass the array of date which needs to be disabled
  • Defined weekends function in the JS snippet will take care of disabling the weekend days

JavaScript Snippet:

function toISODate(d) {
    var z = function(n) {return ('0' + n).slice(-2);};
    return d.getFullYear() + '-' + z(d.getMonth()+1) + '-' + z(d.getDate()); 
}

function specificDays(date) {
    var rdatedData = JSON.parse($parameters.SpecificDays);
    return rdatedData.includes (toISODate(date));
}

function weekends(date) {
    return (date.getDay() === 0 || date.getDay() === 6);
}

var dataPickerProvider = OutSystems.OSUI.Patterns.DatePickerAPI.GetDatePickerItemById($parameters.DatePickerWidgetId)._provider;
dataPickerProvider.config._disable = [weekends, specificDays];
dataPickerProvider.clear();

Demo Screen: DisableDays_DatepickerTask

Refer to the attached oml

Refer to the FlatPickr Documentation: #disabling-dates-by-a-function

I hope this helps you!


Kind regards,

Benjith Sam

Sparkle_DisableDays_DatePicker_Task.oml
2021-07-14 10-21-07
Krunal Vyas

Thanks Benjit

I will give this a try.

Thanks,

Krunal

2021-03-18 21-03-15
Benjith Sam
 
MVP

You're welcome, Krunal.

Glad to help you :)


Kind regards,

Benjith Sam

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hello.

In OutSystems UI version 2.12.0 planned for the end of October, we'll make client actions available to disable a list of days and choose weekdays to disable.

Cheers,
GM

2021-03-18 21-03-15
Benjith Sam
 
MVP

Thank you, Gonçalo, for the update.


Kind regards,

Benjith Sam

2023-03-21 16-59-35
Gaetano Cerciello

@Gonçalo Martins is this feature available now or has it not been released yet ?

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hello @Gaetano Cerciello 

As you can check on the release notes for version 2.12.0 under the codes ROU-3301 and ROU-3381, these features are already available on the product.

2019-06-17 11-18-07
Dmitrii Lubenskii

DatePicker does not work: it is not updated with value on client events.

2022-07-19 16-56-14
Giuliana Silva
Staff

Hello @Dmitrii Lubenskii!

Can you give more details about what is not working on DatePicker and how can I reproduce the issue?

Regards, 

Giuliana.

2019-06-17 11-18-07
Dmitrii Lubenskii

Hi,

  • If some other event is fired, and I change DatePicker variable assigned to it, then DatePicker is not updated with a new value in UI.
  • If DatePicker set Enabled = false, then if I change Enabled condition in a client event, then it stays disabled.

Only one way to workaround it is put DatePicker inside an IF, and show it in UI only when a new value is set.

2022-07-19 16-56-14
Giuliana Silva
Staff

Thank you for your reply.

"If some other event is fired, and I change DatePicker variable assigned to it, then DatePicker is not updated with a new value in UI."

  • To update the date please use DatePickerUpdateDate Client Action, it is the best practice.

"If DatePicker set Enabled = false, then if I change Enabled condition in a client event, then it stays disabled."

  • This issue is already in our backlog. Please refer to ROU-4098 in the release notes of the future releases.

Regards,

Giuliana.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.