Modifications

This commit is contained in:
Leigh Pointer
2024-01-02 16:09:54 +01:00
parent 233f40f3e9
commit 5ce5193430
7 changed files with 55 additions and 173 deletions

View File

@ -572,7 +572,35 @@ namespace Oqtane.Shared
return (localDateTime?.Date, localTime);
}
public static bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
{
// Check if both dates are null, in which case the validation passes
if (effectiveDate == DateTime.MinValue && expiryDate == DateTime.MinValue)
{
return true;
}
// Check if EffectiveDate is not null and ExpiryDate is null
if (effectiveDate != DateTime.MinValue && expiryDate == DateTime.MinValue)
{
return true;
}
// Check if EffectiveDate is null and ExpiryDate is not null
if (effectiveDate == DateTime.MinValue && expiryDate != DateTime.MinValue)
{
return true;
}
// Check if ExpiryDate is not null and EffectiveDate is after ExpiryDate
if (expiryDate != DateTime.MinValue && effectiveDate != DateTime.MinValue && effectiveDate > expiryDate)
{
return false;
}
// If none of the above conditions are met, validation passes
return true;
}
[Obsolete("ContentUrl(Alias alias, int fileId) is deprecated. Use FileUrl(Alias alias, int fileId) instead.", false)]
public static string ContentUrl(Alias alias, int fileId)
{