Format Conversion Shows Incorrect Year for Certain Dates in 2020

Applies to: All versions of Ephesoft Transact

Issue

When creating Format Conversion rules to modify dates, you may experience unexpected behavior with converted years. Specifically, certain days at the end of December may be incorrectly converted to the wrong year.

For example, the sample value of “12/30/2020” may be converted to “12/30/2021”.

Root Cause

The year can have different values depending on using lowercase or uppercase in your Format Conversion rule, which affects how the rule defines a year.

  • Lowercase “y” is the day-based year
  • Uppercase “Y” is the week-based year

This difference may cause your rules to execute correctly except for when dealing with dates at the very end of some years. This is illustrated in the following example:

For the date “12/31/2020” (December 31, 2020), using “YYYY” will incorrectly output 2021.

Figure 1. Uppercase Y in Format Conversion Rule

However, using “yyyy” for the same date will correctly output 2020.

Figure 2. Lowercase y in Format Conversion Rule

This is because December 31, 2020, is also in the first week of 2021.

Solution

To prevent this issue, Ephesoft recommends always using the lowercase “y” for years in your Format Conversion rules.