Hi!

I'm trying to change dinamically the datefomat in rich_widget Input_Calendar, depending on user location. To simplify the example, I have created a page with two cases, one in which I don't use a custom dateformat, so match with service center dateformat and other custom:

But when the dateformat not match with Service Center format, client validations say that date is not valid (I suppose because javascript is expecting service center date format), and if I put the validation as "server validation", the retrieved date variable is null


What I'm doing wrong? How I can have in one application different dateformats that not match with Service Center default dateformat?


I have created a test app to show this


Thanks,
Carlos

Hi Carlos,

If you're differing the service center format, use a server action to convert date to text in desired format for display or vice-versa. 

You may also use Custom Input Masks component, which let you format date time. 


OutSystems has a default DataTime format as defined in ServiceCenter. Platform always expects service center defined format as input through out in the system. If you want to support multiple or different format than Service Center one, you have to define a local variable with Text type to get the value. 

Later, in the action that uses the date time, you have to change the local variable into a DateTime object for application to understand the DateTime value. 

Again, in the preparation you have to write an action that converts the DateTime value into the Text including the desired formatting for the component to parse.


Hi Swatantra Kumar,

The problem with "Custom Input Masks" component, is that can not be used with Rich Widget component, so you can "type" dates in the desired format, but I will not have the calendar to visualy select a date.

Talking about the other solution (convert to text) have a few problems: I can not have a date variable with clien side validations, and forces me to re-code a lot of pages where we use dates...

I expected the DateFormat be automatic, and internally to treat the transformation. There is no simpler way to use that property without need re-code all pages that use dates?

Solution

Hi Swatantra Kumar,

If you use the Date Picker from OutsystemsUIWeb:
https://www.outsystems.com/outsystems-ui/patterns/web/DatePicker

Together with Custom Input Masks:
https://www.outsystems.com/forge/component-overview/647/custom-input-masks

It will work, just make sure that you only set the format you want in the Custom Input Mask and not on the actual date picker.

Best Regards,
Jose Torrao

Solution

Hi José!

I've tested with OS11 datepicker as you said, and works fine!! Thanks a lot for help!!

I attach a new oml just in case somebody needs to take a look to the implementation


Also thanks to Swatantra Kumar for his answers, the workarrounds were close to providing a solution to my problem


Carlos