Symptom
In case of User API (ODATA) UPSERT, system saves and shows incorrect data for the field like "dateOfBirth" when the date which is being sent is earlier than 1583. If the date is 1583 or higher, then the system saves and shows correct date.
Images/data in this KBA are from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
SAP SuccessFactors
Reproducing the Issue
Case 1: ISSUE ( Incorrect Data is getting returned ):
Send OData request POST (UPSERT) which contains the below data in body:
<m:properties>
<d:dateOfBirth m:type="Edm.DateTime">1582-02-13T00:00:00</d:dateOfBirth>
</m:properties>
Then QUERY the same data for the same user, it gets returned as below:
<m:properties>
<d:dateOfBirth m:type="Edm.DateTime">1582-02-03T00:00:00</d:dateOfBirth>
</m:properties>
Case 2: Correct Data is getting Returned:
Send OData request POST (UPSERT) which contains the below data in body:
<m:properties>
<d:dateOfBirth m:type="Edm.DateTime">1583-02-13T00:00:00</d:dateOfBirth>
</m:properties>
Then QUERY the same data for the same user, it gets returned as below:
<m:properties>
<d:dateOfBirth m:type="Edm.DateTime">1583-02-13T00:00:00</d:dateOfBirth>
</m:properties>
Cause
This issue has occurred due to historical calendar switch from Julian to Gregorian in that year. According to Wikipedia, when the new calendar was put in use, the error accumulated in the 13 centuries since the Council of Nicaea was corrected by a deletion of 10 days. The Julian calendar day Thursday, 4 October 1582 was followed by the first day of the Gregorian calendar, Friday, 15 October 1582 (the cycle of weekdays was not affected).
Note that some countries - in particular England - did not adopt that calendar until 1752. And Russia, for example, didn't adopt it until well into the 20th century!
Resolution
Currently, there is no perfect way to solve the issue. So, it is suggested not to use too old historical date for field like "dateOfBirth".
Keywords
dateOfBirth, incorrect data, USER, UPSERT, 1583 , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , Problem