From 6767b4ca74b48997dcb231be538b52888c635d48 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Sat, 14 Nov 2020 19:21:09 -0700 Subject: [PATCH 1/3] add datetime.tzinfo=None (closes issue #208) --- Changelog | 2 ++ cftime/_cftime.pyx | 1 + 2 files changed, 3 insertions(+) diff --git a/Changelog b/Changelog index 3ef52586..1261dfaf 100644 --- a/Changelog +++ b/Changelog @@ -10,6 +10,8 @@ version 1.3.0 (release tag v1.3.0rel) digits can be handled. Allow 'calendar=None' inr cftime.date2num (calendar associated with first input datetime object is used - we may want to change the default from 'standard' to None in a future release). + * add `cftime.datetime.tzinfo=None` for compatibility with python datetime + (issue #208). version 1.2.1 (release tag v1.2.1rel) ===================================== diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index d473d3d9..cfe5f75b 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -930,6 +930,7 @@ The default format of the string produced by strftime is controlled by self.form self.microsecond = microsecond self._dayofwk = dayofwk self._dayofyr = dayofyr + self.tzinfo = None if calendar: calendar = calendar.lower() if calendar == 'gregorian' or calendar == 'standard': From 50040a1f94a4a93a13c965995bf3cf71f9fda4fd Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Sat, 14 Nov 2020 20:19:52 -0700 Subject: [PATCH 2/3] update --- cftime/_cftime.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index cfe5f75b..45173f37 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -910,6 +910,7 @@ The default format of the string produced by strftime is controlled by self.form cdef readonly str calendar cdef readonly int _dayofwk, _dayofyr cdef readonly bint has_year_zero + cdef object tzinfo # Python's datetime.datetime uses the proleptic Gregorian # calendar. This boolean is used to decide whether a From 1733284e467823cb944f1ce4a2724b0abf1332e2 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Sun, 15 Nov 2020 07:22:49 -0700 Subject: [PATCH 3/3] update --- cftime/_cftime.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index 45173f37..cacbe1f0 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -910,7 +910,7 @@ The default format of the string produced by strftime is controlled by self.form cdef readonly str calendar cdef readonly int _dayofwk, _dayofyr cdef readonly bint has_year_zero - cdef object tzinfo + cdef readonly object tzinfo # Python's datetime.datetime uses the proleptic Gregorian # calendar. This boolean is used to decide whether a