C
C#2y 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
Pobiega2y ago
That information isn't available in the http request by default, so your client will need to send it to the backend
Dusty
DustyOP2y ago
Yea that makes sense but what is the best way to send it?
Pobiega
Pobiega2y ago
query string, header, body? doesnt matter
Angius
Angius2y ago
Some custom x-something header, IMHO
Dusty
DustyOP2y ago
Alr thx
Accord
Accord2y 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.
Want results from more Discord servers?
Add your server