Open Closed

Auto DST Adjustment #8597


User avatar
0
yilmaz.atalar created
  • ABP Framework version: v8.3 Hi, There a lot of customers who are using the product from the countries utilising DST (daylight saving time) and we don’t have an option to auto adjust timezone based on DST changes. Can we enhance the product to adjust timezone accommodating DST? Do you have any solution in that case?

11 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello

    Can you please check this document https://abp.io/docs/9.0/framework/infrastructure/timing#time-zones

    Thank you.

  • User Avatar
    0
    yilmaz.atalar created

    Hello,

    I checked this document before generating a ticket. I found https://www.iana.org/time-zones in https://abp.io/docs/8.3/framework/infrastructure/timing#time-zones. In iana, they said: 'The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe.'

    In light of this information, can we say that the DST requirement has been met? According to the information we will receive from you, we will pass our custom and only UTC-supporting timezone structure in the product to abp's time zone parameter. Could you please confirm?

    Thank you very much,

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can set Clock to UTC, after that all data time will be UTC, then you can convert the UTC time to the user's timezone.

    If the user doesn't set the time zone, you can get the current time zone from the browser.

    Configure<AbpClockOptions>(options =>
    {
        options.Kind = DateTimeKind.Utc;
    });
    
  • User Avatar
    0
    yilmaz.atalar created

    I couldn't understand what you were trying to say.

    My question is: If your timezone capability supports DST, we will pass our custom and only UTC-supporting timezone structure in the product to abp's time zone parameter.

    Does your timezone capability support DST feature? Could you please confirm?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Does your timezone capability support DST feature? Could you please confirm?

    ABP timezone is just a setting. The user or system can set it.

    You have to add code to convert UTC to DST.

    1. All date time from the backend is UTC .
    2. Get the user's current timezone.
    3. check if the timezone is DST.
    4. convert UTC time to user timezone and add or subtract a few hours based on DST info.
  • User Avatar
    0
    yilmaz.atalar created

    I see the country parameters when I look at the Time Zone settings' list. Do they include DST info?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think they only are time offset with UTC.

    eg: UTC-5, UTC+3, UTC+8

  • User Avatar
    0
    yilmaz.atalar created

    When I saw the lists' country parameters, I thought it include the DST info. Could you please confirm your idea and be sure? If it includes DST parameters, we'll change, if not, we won't change. You can find DST parameters here: https://www.timeanddate.com/time/dst/2024.html

  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    hi

    The list arekey-value of timezone. But you can get DST info by TZConvert https://github.com/mattjohnsonpint/TimeZoneConverter

    var timeZoneInfo = TZConvert.GetTimeZoneInfo("Central Europe Standard Time");
    
    Time Zone Name: (UTC+01:00) Central European Time (Budapest)
    Time Zone ID: Europe/Budapest
    Standard Time Offset: 01:00:00
    
    ..///
    Effective Period: 2024/3/31 - 2024/10/27
    Daylight Saving Offset: 01:00:00
    Start: System.TimeZoneInfo+TransitionTime
    End: System.TimeZoneInfo+TransitionTime
    Effective Period: 2025/3/30 - 2025/10/26
    Daylight Saving Offset: 01:00:00
    Start: System.TimeZoneInfo+TransitionTime
    End: System.TimeZoneInfo+TransitionTime
    ..///
    
  • User Avatar
    0
    yilmaz.atalar created

    Thanks, we'll evaluate this solution.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.2.0-preview. Updated on January 23, 2025, 12:17