Skip to content

Commit 8971b29

Browse files
authored
API docs: adding version notes to temporal types (#799)
* API docs: adding version notes to temporal types * API docs: fix typo: parameter name
1 parent 47da8d2 commit 8971b29

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

neo4j/time/__init__.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def days_in_month(cls, year: int, month: int) -> int:
968968
"""Return the number of days in `month` of `year`.
969969
970970
:param year: the year to look up
971-
:param year: the month to look up
971+
:param month: the month to look up
972972
973973
:raises ValueError: if `year` or `month` is out of range:
974974
:attr:`MIN_YEAR` <= year <= :attr:`MAX_YEAR`;
@@ -1380,6 +1380,9 @@ class Time(time_base_class, metaclass=TimeType):
13801380
:param tzinfo: timezone or None to get a local :class:`.Time`.
13811381
13821382
:raises ValueError: if one of the parameters is out of range.
1383+
1384+
..versionchanged:: 5.0
1385+
The parameter ``second`` no longer accepts :class:`float` values.
13831386
"""
13841387

13851388
# CONSTRUCTOR #
@@ -1497,6 +1500,11 @@ def from_ticks(cls, ticks: int, tz: _tzinfo = None) -> Time:
14971500
14981501
:raises ValueError: if ticks is out of bounds
14991502
(0 <= ticks < 86400000000000)
1503+
1504+
..versionchanged:: 5.0
1505+
The parameter ``ticks`` no longer accepts :class:`float` values
1506+
but only :class:`int`. It's now nanoseconds since midnight instead
1507+
of seconds.
15001508
"""
15011509
if not isinstance(ticks, int):
15021510
raise TypeError("Ticks must be int")
@@ -1606,7 +1614,12 @@ def utc_now(cls) -> Time:
16061614

16071615
@property
16081616
def ticks(self) -> int:
1609-
"""The total number of nanoseconds since midnight."""
1617+
"""The total number of nanoseconds since midnight.
1618+
1619+
.. versionchanged:: 5.0
1620+
The property's type changed from :class:`float` to :class:`int`.
1621+
It's now nanoseconds since midnight instead of seconds.
1622+
"""
16101623
return self.__ticks
16111624

16121625
@property
@@ -1621,7 +1634,17 @@ def minute(self) -> int:
16211634

16221635
@property
16231636
def second(self) -> int:
1624-
"""The seconds of the time."""
1637+
"""The seconds of the time.
1638+
1639+
.. versionchanged:: 4.4
1640+
The property's type changed from :class:`float` to
1641+
:class:`decimal.Decimal` to mitigate rounding issues.
1642+
1643+
.. versionchanged:: 5.0
1644+
The property's type changed from :class:`decimal.Decimal` to
1645+
:class:`int`. It does not longer cary sub-second information.
1646+
Use `attr:`nanosecond` instead.
1647+
"""
16251648
return self.__second
16261649

16271650
@property

0 commit comments

Comments
 (0)