Notifications

40 views

Description

When the system property 'glide.sys.date_format' is set to MM-dd-yy, the year value is not properly saved in the database.

If the year value is set between 00 an 38, the ShowXML shows the year to be 2000 - 2038.

If the year value is set to 39 or higher, the ShowXML shows the year to be 1939, 1940, etc.

Steps to Reproduce

  1. Set the system property 'glide.sys.date_format' to MM-dd-yy
  2. Run cache.do to clear the cache
  3. Open an incident form (incident.do)
  4. From the context menu, go to Configuration>Form Layout, create a new Date field and add it to the incident form.
  5. Create a new incident and set the date value to "11-20-38" and save the form
    • Here the year value on the form is 38 and the expected value is 2038.
  6. Check this date value in Show XML and the year value is set properly as 2038.
  7. Update this date value and change it to 39.
    • The expected value is 2039.
  8. Check this date value in Show XML and the year value is set to 1939, which is unexpected.

With the "yy" format, the default Java date time format uses an 80-20 metric - it assumes the date was either less than 80 years in the past and less than 20 years in the future (see SimpleDateFormat [Java 7 API] for more information).

In the previous example:

11-20-38 is within 20 years in the future, so the expected behavior is that it reads as 2038, which is it does.
11-20-39 is within 80 years in the past, so the expected behavior is that it reads as 1939, which it does.

Workaround

This is expected behavior and by design in the current releases. The alternative is to use the YYYY format instead of YY.


Related Problem: PRB1350557

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-07-11 00:07:37
Published:2019-07-11