admin-ch / CovidCertificate-Apidoc

API documentation for the integration of primary systems with the machine to machine API
73 stars 7 forks source link

Dangerous dateOfBirth date format recommandation for java applications for the latest dates of the year #40

Open arisjramos opened 2 years ago

arisjramos commented 2 years ago

Hello,

For JAVA application, There is a misleading date format recommendation in the personal-data section of the readme.md for the dateOfBirth field

ref : https://github.com/admin-ch/CovidCertificate-Apidoc#personal-data

it's written :

dateOfBirth: date of birth of the covid certificate owner. Format: ISO 8601 date without time or YYYY-MM or YYYY

In the JAVA language, YYYY (uppercase) indicates the year of the week. For people born in the latest dates of the year, like 29.12.YYYY or 30.12.YYYY or 31.12.YYYY, there are big chances that the formatting of those dates will fall in a year bigger by 1 that expected, example : 1980-12-30 after format with the YYYY-MM pattern will yield "1981-12".

To avoid this problem, change de recommendation to yyyy (lowercase) that indeed seems universally adopted by all languages to format the year of the date.

for more informations in java format see : https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html?is-external=true

Aris Javier Ramos Hôpitaux Universitaires de Genève