How to fix DateTime Culture Info Issue?

Praveen Kumar B S 0 Reputation points
2024-03-14T09:37:27.1633333+00:00

Hi everyone,

I'm developing an HR application using Angular 13 and a .Net 6 Web API. I'm facing a challenge related to handling different time zones for users.

The Scenario:

The application is deployed in the AWS Asia/Mumbai region. When users from various time zones access the app, a culture information issue arises. Let's consider two examples:

  • User X (USA, New York): Sets a reminder at 10:00 AM for a task. The application should send the reminder to User X at 10:00 AM in their local New York time zone.
  • User Y (Russia, Moscow): Sets a reminder at 12:00 AM for a task. The application should send the reminder to User Y at 12:00 AM in their local Moscow time zone.

The Problem:

Currently, the application triggers reminders based on the server's time zone (Asia/Mumbai). This results in incorrect reminder times for users in different locations.

Technology Stack:

  • Frontend: Angular 13
  • Backend: .Net 6 Web API
  • Scheduling: Hangfire

Seeking Help:

I've been unable to resolve this issue on my own. I'd appreciate any suggestions or ideas on how to ensure reminders are sent based on the user's specific time zone.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,648 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,400 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,731 Reputation points
    2024-03-14T16:06:12.15+00:00

    the server should always use UTC time. The angular code should convert any time fields received from the server to local time. any time fields sent to the server should be in UTC time. see the javascript Date object for converting times:

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

    0 comments No comments