Base solution for your next web application
Open Closed

TimingSettingProvider Default value (aspnet core / angular v5.6.2) #5864


User avatar
0
klir created

Hi all,

I've added in our core module the following settings in order to support UTC time and multitimezone

//Adding setting providers
Configuration.Settings.Providers.Add<AppSettingProvider>();
Configuration.Settings.Providers.Add<TimingSettingProvider>();
Clock.Provider = ClockProviders.Utc;

And then in our appsettings the default TimeZone

"Abp": {
  "Timing": {
    "TimeZone": "GMT Standard Time"
  }
},

However when I run the project it always displays UTC as the default timezone. As a workaround I've removed TimingSettingProvider and added it manuallly in my shared settings the following that will read that property from appsettings. Did I missed something here?

new SettingDefinition(TimingSettingNames.TimeZone, 
                                        GetFromSettings("Abp:Timing:Timezone", "UTC"), null, //TODO: Can we use here localization?
                                        scopes: SettingScopes.Application | SettingScopes.Tenant | SettingScopes.User, 
                                        clientVisibilityProvider: new VisibleSettingClientVisibilityProvider())

Regards


4 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    What's wrong?

  • User Avatar
    0
    klir created

    If I use

    Configuration.Settings.Providers.Add<TimingSettingProvider>(); 
    

    then I can't change the default timezone in appsetting.config it's always UTC no matter if I add the setting there. My question is how TimingSettingProvider can be updated via Environmental config settings or appsettings.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @klir

    You need to restart the app after changing the setting value in appsettings.json file. Settings are cached at the application startup.

    Also be sure that there is no user/tenant specific setting about TimingSettingNames.TimeZone in AbpSettings table.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Please reopen if you are still having this problem.