is_utc() returns False when parsing from a UTC date
See original GitHub issueThis date is UTC: '2018-06-21T09:30:00+00:00'
, however, the is_utc()
method returns False
.
>>> pendulum.parse('2018-06-21T09:30:00+00:00').timezone
Timezone('+00:00')
>>> pendulum.parse('2018-06-21T09:30:00+00:00').is_utc()
False
The current implementation is:
def is_utc(self):
return self.timezone_name == 'UTC'
Maybe it can be something like:
def is_utc(self):
return self.timezone.offset == 0
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
`isUtc()` does not seem to be working · Issue #3687
isUtc (); // returns false Even it is not recognizing moment generated UTC dates as UTC, see var utcDate = moment.utc().format(); ...
Read more >moment.js - UTC does not work as i expect it
why does withMoment return the timestamp calculated from the current local-time? how can i achieve that moment.utc() returns the same as Date.
Read more >dart/sdk/lib/core/date_time.dart - external/dart
or by parsing a correctly formatted string, ... Use [isUtc] to determine whether a DateTime object is based in UTC. ... DateTime.now() :...
Read more >Moment.js Tutorial
Use .toDate() to convert back to a JavaScript date. Dates are interpreted as local time. Unless instantiated with moment.utc() .
Read more >UTC
UTC adds .utc .local .isUTC APIs to parse or display in UTC. var utc = require('dayjs/plugin/utc') dayjs.extend(utc) // default local time dayjs().format() ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, reproducing the behavior in 1.5.1 vs 2.x is important for me (and possibly others landing here).
I created a pull request #295 for resolving this issue. I hope it resolves the problem. I would like to ask for a review also.