Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
Leigh Pointer
2025-06-13 19:55:43 +02:00
3 changed files with 29 additions and 9 deletions

View File

@@ -56,7 +56,7 @@
<input id="starting" type="date" class="form-control" @bind="@_startDate" /> <input id="starting" type="date" class="form-control" @bind="@_startDate" />
</div> </div>
<div class="col"> <div class="col">
<input id="starting" type="time" class="form-control" placeholder="hh:mm" @bind="@_startTime" /> <input id="starting" type="time" class="form-control" @bind="@_startTime" placeholder="hh:mm" required="@(_startDate.HasValue)" />
</div> </div>
</div> </div>
</div> </div>
@@ -69,7 +69,7 @@
<input id="ending" type="date" class="form-control" @bind="@_endDate" /> <input id="ending" type="date" class="form-control" @bind="@_endDate" />
</div> </div>
<div class="col"> <div class="col">
<input id="ending" type="time" class="form-control" placeholder="hh:mm" @bind="@_endTime" /> <input id="ending" type="time" class="form-control" placeholder="hh:mm" @bind="@_endTime" required="@(_endDate.HasValue)" />
</div> </div>
</div> </div>
</div> </div>
@@ -82,7 +82,7 @@
<input id="next" type="date" class="form-control" @bind="@_nextDate" /> <input id="next" type="date" class="form-control" @bind="@_nextDate" />
</div> </div>
<div class="col"> <div class="col">
<input id="next" type="time" class="form-control" placeholder="hh:mm" @bind="@_nextTime" /> <input id="next" type="time" class="form-control" placeholder="hh:mm" @bind="@_nextTime" required="@(_nextDate.HasValue)" />
</div> </div>
</div> </div>
</div> </div>
@@ -176,10 +176,18 @@
{ {
job.Interval = int.Parse(_interval); job.Interval = int.Parse(_interval);
} }
job.StartDate = LocalToUtc(_startDate.Value.Date.Add(_startTime.Value.TimeOfDay)); job.StartDate = _startDate.HasValue && _startTime.HasValue
job.EndDate = LocalToUtc(_endDate.Value.Date.Add(_endTime.Value.TimeOfDay)); ? LocalToUtc(_startDate.GetValueOrDefault().Date.Add(_startTime.GetValueOrDefault().TimeOfDay))
job.RetentionHistory = int.Parse(_retentionHistory); : null;
job.NextExecution = LocalToUtc(_nextDate.Value.Date.Add(_nextTime.Value.TimeOfDay));
job.EndDate = _endDate.HasValue && _endTime.HasValue
? LocalToUtc(_endDate.GetValueOrDefault().Date.Add(_endTime.GetValueOrDefault().TimeOfDay))
: null;
job.NextExecution = _nextDate.HasValue && _nextTime.HasValue
? LocalToUtc(_nextDate.GetValueOrDefault().Date.Add(_nextTime.GetValueOrDefault().TimeOfDay))
: null;
job.RetentionHistory = int.Parse(_retentionHistory);
try try
{ {
@@ -198,5 +206,4 @@
AddModuleMessage(Localizer["Message.Required.JobInfo"], MessageType.Warning); AddModuleMessage(Localizer["Message.Required.JobInfo"], MessageType.Warning);
} }
} }
} }

View File

@@ -503,6 +503,10 @@ namespace Oqtane.Modules
// date conversion methods // date conversion methods
public DateTime? UtcToLocal(DateTime? datetime) public DateTime? UtcToLocal(DateTime? datetime)
{ {
// Early return if input is null
if (datetime == null)
return null;
TimeZoneInfo timezone = null; TimeZoneInfo timezone = null;
try try
{ {
@@ -519,11 +523,16 @@ namespace Oqtane.Modules
{ {
// The time zone ID was not found on the local computer // The time zone ID was not found on the local computer
} }
return Utilities.UtcAsLocalDateTime(datetime, timezone); return Utilities.UtcAsLocalDateTime(datetime, timezone);
} }
public DateTime? LocalToUtc(DateTime? datetime) public DateTime? LocalToUtc(DateTime? datetime)
{ {
// Early return if input is null
if (datetime == null)
return null;
TimeZoneInfo timezone = null; TimeZoneInfo timezone = null;
try try
{ {
@@ -540,6 +549,7 @@ namespace Oqtane.Modules
{ {
// The time zone ID was not found on the local computer // The time zone ID was not found on the local computer
} }
return Utilities.LocalDateAndTimeAsUtc(datetime, timezone); return Utilities.LocalDateAndTimeAsUtc(datetime, timezone);
} }

View File

@@ -103,6 +103,9 @@
{ {
var cookieConsentSetting = SettingService.GetSetting(PageState.Site.Settings, "CookieConsent", string.Empty); var cookieConsentSetting = SettingService.GetSetting(PageState.Site.Settings, "CookieConsent", string.Empty);
_enabled = !string.IsNullOrEmpty(cookieConsentSetting); _enabled = !string.IsNullOrEmpty(cookieConsentSetting);
if (!_enabled) return;
_optout = cookieConsentSetting == "optout"; _optout = cookieConsentSetting == "optout";
_actioned = await CookieConsentService.IsActionedAsync(); _actioned = await CookieConsentService.IsActionedAsync();