diff --git a/src/Admin/Jobs/JobsHostedService.cs b/src/Admin/Jobs/JobsHostedService.cs index 4cc63740f..05d89e7bc 100644 --- a/src/Admin/Jobs/JobsHostedService.cs +++ b/src/Admin/Jobs/JobsHostedService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Bit.Core; @@ -26,8 +27,13 @@ namespace Bit.Admin.Jobs public override async Task StartAsync(CancellationToken cancellationToken) { - var timeZone = _globalSettings.SelfHosted ? TimeZoneInfo.Utc : - TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); + var timeZone = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? + TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time") : + TimeZoneInfo.FindSystemTimeZoneById("America/New_York"); + if(_globalSettings.SelfHosted) + { + timeZone = TimeZoneInfo.Utc; + } var everyTopOfTheHourTrigger = TriggerBuilder.Create() .StartNow() diff --git a/src/Billing/Jobs/JobsHostedService.cs b/src/Billing/Jobs/JobsHostedService.cs index 32a353a55..82d159dfe 100644 --- a/src/Billing/Jobs/JobsHostedService.cs +++ b/src/Billing/Jobs/JobsHostedService.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; +using Bit.Core; using Bit.Core.Jobs; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -11,15 +13,26 @@ namespace Bit.Billing.Jobs { public class JobsHostedService : BaseJobsHostedService { + private readonly GlobalSettings _globalSettings; + public JobsHostedService( + GlobalSettings globalSettings, IServiceProvider serviceProvider, ILogger logger, ILogger listenerLogger) - : base(serviceProvider, logger, listenerLogger) { } + : base(serviceProvider, logger, listenerLogger) { + _globalSettings = globalSettings; + } public override async Task StartAsync(CancellationToken cancellationToken) { - var timeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); + var timeZone = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? + TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time") : + TimeZoneInfo.FindSystemTimeZoneById("America/New_York"); + if(_globalSettings.SelfHosted) + { + timeZone = TimeZoneInfo.Utc; + } var everyDayAtNinePmTrigger = TriggerBuilder.Create() .StartNow()