Wijmo DateTime Control is show 100 year's back date when date format is changed

Posted by: nilesh_nichal on 22 June 2021, 9:32 am EST

  • Posted 22 June 2021, 9:32 am EST

    Hi Team,

    Because of this issue our business use-case are failing, we have input format and output format, where both format can be different.

    Scenario :

    1. When date format is set to (MMMM dd, yyyy) and if enter this value (July 21,22 ) then it’s convert in correct format (July 21, 2021). and
    2. if enter this value (July 21, 33) then it’s convert in incorrect format (July 21, 1933).

    This should be convert in correct format as in scenario one.

    Warm Regards

    Nilesh Nichal.

  • Posted 22 June 2021, 10:07 am EST

    Hi Team,

    Apologize there is small typo mistake:

    1. When date format is set to (MMMM dd, yyyy) and if enter this value (July 21,22 ) then it’s convert in correct format (July 21, 2022).
  • Posted 24 June 2021, 12:07 am EST

    Hi Nilesh,

    This is the default behavior of InputDate control, inputDate control allows users to type in dates using any format supported by the Globalize class. And parsing date format is done through parseDate format. In which two-digit years are converted to full years based on the value of the calendar’s twoDigitYearMax property. By default, this is set to 2029, meaning two-digit values of 30 to 99 are parsed as 19xx, and values from zero to 29 are parsed as 20xx.

    You can change this threshold by assigning a new value to the calendar, please refer to the code snippet below:

    // get calendar
    var cal = wijmo.culture.Globalize.calendar;
    
    // changing threshold to 2100, so all values are parsed as 20**
    cal.twoDigitYearMax = 2100;
    
    

    You may refer to the Doc for more information: https://www.grapecity.com/wijmo/api/classes/wijmo.globalize.html#parsedate

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels