C
C#17mo ago
Dusty

✅ Set TimeZone for request duration in ASP.NET Core

Hey, I am generating PDFs on the server with DateTime objects. The problem is that my clients come from several different time zones and want the PDF to be generated in their own time zone. Question: How do I convert the DateTime object to a string using the time zone of the client? Should I just send the browsers time zone as query parameter or are there better approaches?
6 Replies
Pobiega
Pobiega17mo ago
That information isn't available in the http request by default, so your client will need to send it to the backend
Dusty
Dusty17mo ago
Yea that makes sense but what is the best way to send it?
Pobiega
Pobiega17mo ago
query string, header, body? doesnt matter
Angius
Angius17mo ago
Some custom x-something header, IMHO
Dusty
Dusty17mo ago
Alr thx
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.