Skip to content

Commit 6cd9ed7

Browse files
authored
Merge pull request #263 from neo4j/1.7-neotime-update
[1.7] Updated to use faster neotime
2 parents b2c0074 + 62f8d95 commit 6cd9ed7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

neo4j/types/temporal.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636

3737
UNIX_EPOCH_DATE = Date(1970, 1, 1)
38+
UNIX_EPOCH_DATE_ORDINAL = UNIX_EPOCH_DATE.to_ordinal()
3839
UNIX_EPOCH_DATETIME_UTC = DateTime(1970, 1, 1, 0, 0, 0, utc)
3940

4041

@@ -44,7 +45,7 @@ def hydrate_date(days):
4445
:param days:
4546
:return: Date
4647
"""
47-
return UNIX_EPOCH_DATE + Duration(days=days)
48+
return Date.from_ordinal(UNIX_EPOCH_DATE_ORDINAL + days)
4849

4950

5051
def dehydrate_date(value):
@@ -108,7 +109,7 @@ def hydrate_datetime(seconds, nanoseconds, tz=None):
108109
hours, minutes = map(int, divmod(minutes, 60))
109110
days, hours = map(int, divmod(hours, 24))
110111
seconds = (1000000000 * seconds + nanoseconds) / 1000000000
111-
t = DateTime.combine(UNIX_EPOCH_DATE + Duration(days=days), Time(hours, minutes, seconds))
112+
t = DateTime.combine(UNIX_EPOCH_DATE_ORDINAL + days, Time(hours, minutes, seconds))
112113
if tz is None:
113114
return t
114115
if isinstance(tz, int):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
neobolt<2,>=1.7
2-
neotime<2,>=1.7
2+
neotime<2,>=1.7.1

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
from neo4j.meta import package, version
3131

3232
install_requires = [
33-
"neobolt==1.7.0rc5",
34-
"neotime",
33+
"neobolt<2,>=1.7",
34+
"neotime<2,>=1.7.1",
3535
]
3636
classifiers = [
3737
"Intended Audience :: Developers",

0 commit comments

Comments
 (0)