mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
Related to issue #480 I think date should accept a real date, not just the minus 1900 version (#481)
This commit is contained in:
parent
394d6dbcec
commit
941892134a
|
@ -1294,6 +1294,7 @@ class Date(Atomic):
|
|||
_app_tag = Tag.dateAppTag
|
||||
|
||||
def __init__(self, arg=None, year=255, month=255, day=255, day_of_week=255):
|
||||
year = year - 1900 if year >= 1900 else year
|
||||
self.value = (year, month, day, day_of_week)
|
||||
|
||||
if arg is None:
|
||||
|
|
|
@ -1340,6 +1340,7 @@ class Date(Atomic):
|
|||
_app_tag = Tag.dateAppTag
|
||||
|
||||
def __init__(self, arg=None, year=255, month=255, day=255, day_of_week=255):
|
||||
year = year - 1900 if year >= 1900 else year
|
||||
self.value = (year, month, day, day_of_week)
|
||||
|
||||
if arg is None:
|
||||
|
|
|
@ -1322,6 +1322,7 @@ class Date(Atomic):
|
|||
_app_tag = Tag.dateAppTag
|
||||
|
||||
def __init__(self, arg=None, year=255, month=255, day=255, day_of_week=255):
|
||||
year = year - 1900 if year >= 1900 else year
|
||||
self.value = (year, month, day, day_of_week)
|
||||
|
||||
if arg is None:
|
||||
|
|
|
@ -181,3 +181,10 @@ class TestDate(unittest.TestCase):
|
|||
for each in self.notEnoughPreciseOrWrong:
|
||||
Date(each[0])
|
||||
|
||||
def test_date_args(self):
|
||||
t = Tag()
|
||||
date = Date(year=2023, month=2, day=10)
|
||||
date1 = Date(year=123, month=2, day=10)
|
||||
assert date == date1
|
||||
date.encode(t)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user