Best Answer

Completion Date subtracts 1 day when using API call POST /learn/v1/enrollment/batch

  • 27 April 2022
  • 7 replies
  • 137 views

Userlevel 1

Using the batch enrollment to load some historical completion data from our ERP the completion date is one day less than the date in the JSON.  Any ideas why this happens?  

 

I am using the API call - POST /learn/v1/enrollment/batch

 

icon

Best answer by Bfarkas 1 May 2022, 21:00

View original

7 replies

Userlevel 7
Badge +8

Sounds like a time zone issue...make sure yours and your system time zones are the same to see if that helps.

Userlevel 1

We are on Eastern Standard Time, but when I change the Docebo system time zone to Italy, the dates are loaded as expected.  Not sure I understand why, but as a work around  your suggestion to check the system time zone was very helpful.  Thanks.

Userlevel 7
Badge +8

I believe Docebo has their servers on GMT time so if when they use midnight their local time as the time of the event, it would logically add a day when viewed in your time zone...Still odd though since we do not se this same behaviour when using the LMS itself. A good note to make though. Thx

Userlevel 7
Badge +8

Hi @jennyblevinsEKPC just solved for this while we were testing it to load completion history. If you add the time to your completion date, it should solve your issue. We added all records with a 10:00:00 (10 AM) time and we are in the Eastern time zone and now all records appear with the correct date.

So your date should look like this (depends on the LMS date format you have in place; you might need to change it from this example.

We use YYYY-MM-DD, therefore, the input looks like: 2022-04-29 10:00:00

Userlevel 7
Badge +4

Time time time! Always annoying and will get ya when dealing with things around midnight and time zones. Be careful with being exactly at 4 hours the day prior as when daylight savings changes it will shift to minus 5. In a perfect world if programming this look for some sort of time library to convert everything to the same (either to yours or to UTC) for you so that you do not need to think about it. 

Userlevel 7
Badge +8

yup, this is why we are using 10 AM although we’re in the Eastern time zone. It covers the whole country nicely.

Userlevel 7
Badge +4

yup, this is why we are using 10 AM although we’re in the Eastern time zone. It covers the whole country nicely.

Agreed, usually do the same if the time doesn’t matter, but in some cases it needs to be accurate, so becomes an issue. Hate time!

Reply