* subtle bug in the condition

subtle bug in the condition used for checking if the store is open within the specified hours.
Ensures that both conditions are checked logically (time must be both greater than or equal to the opening time and less than or equal to the closing time for the store to be considered open)

* update output
This commit is contained in:
Stanislav Hut 2024-09-17 16:17:16 +03:00 коммит произвёл GitHub
Родитель 9ec74a392f
Коммит fadc18d0f8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -34,7 +34,7 @@ public struct StoreInfo
storeDelta = tz.GetAdjustmentRules()[tz.GetAdjustmentRules().Length - 1].DaylightDelta;
TimeSpan comparisonTime = time + (offset - tz.BaseUtcOffset).Negate() + (delta - storeDelta).Negate();
return comparisonTime >= open & comparisonTime <= close;
return comparisonTime >= open && comparisonTime <= close;
}
}
}
@ -66,7 +66,7 @@ public class Example
// The example displays the following output:
// Store is open now at 15:29:01.6129911: True
// Store is open at 08:00:00: True
// Store is open at 21:00:00: False
// Store is open at 21:00:00: True
// Store is open at 04:59:00: False
// Store is open at 18:31:00: False
// Store is open at 18:31:00: True
// </Snippet2>