How is your experience with the OutSystems Community?
65
Views
7
Comments
Manual input changes to another date in editable datepicker

Hello All,

I am using the datepicker in editable mode. When i try to enter the date manually  25121997 in DDMMYYY format it automatically converts to different date 01/21/1999.

link and oml attached here URL

Refered many workarounds but it doesn't give appropriate result. 

https://www.outsystems.com/forums/discussion/82276/manually-input-datepicker-changes-input-date-to-other-date/

Can anyone suggest how can we fix this issue

Regards,

Ellakkiya.S

test.oml
2023-07-21 02-30-20
Masahiro Ohno

The newDatepicker is set to "MM/DD/YYYYY".

UserImage.jpg
Ellakkiya

Hi Masahiro Ohno ,

I have changed the date format to "DD/MM/YYYY".

But still causing the same issue

2023-11-22 10-51-50
Jozy Sohail

Hi Ellakkiya,

I think you should enter date with / as a delimiter to separate day month and year then it will work fine.

Hope it helps.

Thanks 

UserImage.jpg
Ellakkiya

Hi Jozy Sohail,

Yes if we enter date with delimiter then it will work fine.

But out client is asking for user friendly, without delimiter also it should work fine.

Rightnow it is not working without delimiter


2022-03-21 09-36-03
Andy Smy

If it isn't able to consume the input without slashes then it should error, not apparently come back with a random date (since even mm/dd/yyyy doesn't explain it e.g. 01011980 becomes 01/11/1980 ?!)

2025-01-17 13-21-13
Clarisse Carneiro

Hi Ellakkiya,

Did you find a solution for this?

Best regards,

Clarisse

2022-02-10 13-36-05
KES

I'm not sure if the problem is exactly the same, but I found this topic:
https://www.outsystems.com/forums/discussion/82276/outsystems-ui-manually-input-datepicker-changes-input-date-to-other-date/ 

Solution - that worked for me - was to create an 'OnInitialize' screen action with the following JavaScript:

setTimeout(function() {
    var datePickerInpt = document.getElementById($parameters.DatePickerInputId).querySelector('.input');
    datePickerInpt.addEventListener('input', function() {
        let v = this.value.replace(/\D/g, ''); // only numbers
        if (v.length === 8) {
            this.value = v.slice(0,2) + '-' + v.slice(2,4) + '-' + v.slice(4);
         }
    });
}, 100); 

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