Time difference import posts via API in France

AI-generated summary

FLucas is experiencing a time difference when importing posts via the Discourse API. The imported posts have a 1-2 hour offset, despite the local machine and host machine having the same timezone (CET). The issue seems to be due to the API interpreting the provided dates as UTC, while the system is set to CET. Jagster confirms this suspicion, suggesting that the API treats the dates as UTC and applies the offset accordingly.

Hi,

I’m almost finished migrating data from an old forum to a Discourse forum.

When I import my posts via CURL and the Discourse APIs, I get a time lag.

Example 1:

curl -X POST "https://monappli/posts.json" -H \
-H "Api-Key: cle_api" \
-H "Api-Username: username" \
-F "category=number_category" \
-F $'title=title' \
-F $'raw=description' \
-F "created_at=2004-05-27 *12:18*"

→ In Discourse: 27 mai 2004 14:18 (2 hours time difference)

Example 2:

curl -X POST "https://monappli/posts.json" \
-H "Api-Key: cle_api" \
-H "Api-Username: username" \
-F "category=category_number" \
-F $'title=title' \
-F $'raw=description' \
-F "created_at=2005-01-24 *16:23*"

→ In Discourse: 24 janvier 2005 17:23 (1 hour time difference)

I looked at the dates on my different machines:

  • on my local station: Thu. Dec. 21 2023 14:23:13 CET
  • on the host machine containing docker Discourse: Thu. Dec. 21 14:23:13 CET 2023
  • in docker: Thu. Dec 21 2023 13:23:13 UTC (1 hour offset)

Can you tell me how to insert the dates of my old forums without time difference?

Thanks for your help

I don’t know how to fix that but I’m quire sure times you are using via curl are seen as UTC. And then you have one hours offset at winter and two hours ar spring/summer.