Open Closed

How to set permanent Default Language and DateTime format? #1439


User avatar
0
mervintan created

We have tried to configure the default language as below screenshot

Browser: Chrome Language: en-GB

Browser: Chrome (Incognito) Language: en

We are also trying configure the date format as dd/MM/yyyy but due to language configuration, it will revert to MM/dd/yyyy at times, resulting in below error

ABP Framework Version: v4..0.0 UI Type: MVC / Razor Pages Tiered (MVC): Yes


4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    See https://support.abp.io/QA/Questions/1315/How-can-I-set-default-language-to-FI

  • User Avatar
    0
    mervintan created

    Hi, we have tried the method mentioned in the link but it wasn't really helpful. Some additional info & questions as below

    Time Zone We’ve followed the documentation below for the time zone conversion. https://docs.abp.io/en/abp/latest/Timing

    The Abp.Timing.Timezone settings was setup in the appsettings.json with the value “Asia/Kuala_Lumpur” (Time Zone Id) but we encountered an exception. After changing the value to **“Singapore Standard Time” **(Standard Time Zone Name), the error was resolved.

    However, I’m not able to find any documentation on the abp io site on how to implement the datetime conversion from UTC to local time for both server and client-side.

    I was able to find similar usage of the Abp.Timing.Timezone at the following site https://support.aspnetzero.com/QA/Questions/3237/Correct-way-to-use--AbpTiming where it specified to use moment-timezone for client-side conversion using IANA timezoneId. But there are no specific ways to implement this on the client-side and I’m not able to find implementation on the server side. For server side are we supposed to use .Net Core provided method (https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.converttime?view=net-5.0) or ABP has this function built-in?

    Additionally, I’m not able to find documentation on how to handle user from multiple time zones.

    Questions:-

    1. How to implement the UTC to local conversion using ABP approach after setting up Abp.Timing.Timezone for client-side and server side?
    2. How to handle users that comes from different timezones?

    DateTime Format The time zone is affecting the input field with type=”date” which resulted in input value unable pass over to the back-end.

    1. After we configure to add en-MY languages to the Module, the input field with type=”date” is unable to pass values with date after 12th. But on the other hand, the default date time input with time format was able to pass the correct value.
    2. After removing the en-MY configuration from Module, both inputs are working fine.
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ASP.NET Core use current culture to handle datetime format. abp also.

    For front-end, we integrated luxon to convert datetime to current culture format. see :https://github.com/abpframework/abp/pull/5147

    For back-end: you can try to use ITimezoneProvider to handle the time zone base on time zone settings. https://docs.abp.io/en/abp/latest/Timing#itimezoneprovider

    I think you can create a middleware to change the current culture .

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11