diff options
author | Claire Childs <claire.childs@mongodb.com> | 2020-09-24 19:09:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-09 22:39:40 +0000 |
commit | a8dc889504e467595dd3337913a8f346aa031ad8 (patch) | |
tree | 1e24dc574c36a128f5cdb9c2189f1b2874af3bb8 /src/mongo/db/query/datetime | |
parent | 393c2ad49763c9342a5d1a7cac85cd25e69785fe (diff) | |
download | mongo-a8dc889504e467595dd3337913a8f346aa031ad8.tar.gz |
SERVER-49977 support $dateToParts in SBE
Diffstat (limited to 'src/mongo/db/query/datetime')
-rw-r--r-- | src/mongo/db/query/datetime/date_time_support.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/query/datetime/date_time_support.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp index 199a3100453..a0c56878a89 100644 --- a/src/mongo/db/query/datetime/date_time_support.cpp +++ b/src/mongo/db/query/datetime/date_time_support.cpp @@ -347,6 +347,11 @@ boost::optional<Seconds> TimeZoneDatabase::parseUtcOffset(StringData offsetSpec) return boost::none; } +bool TimeZoneDatabase::isTimeZoneIdentifier(StringData timeZoneId) const { + return (_timeZones.find(timeZoneId) != _timeZones.end()) || + static_cast<bool>(parseUtcOffset(timeZoneId)); +} + TimeZone TimeZoneDatabase::getTimeZone(StringData timeZoneId) const { auto tz = _timeZones.find(timeZoneId); if (tz != _timeZones.end()) { diff --git a/src/mongo/db/query/datetime/date_time_support.h b/src/mongo/db/query/datetime/date_time_support.h index 8035c9239d5..a97a2f4b5fd 100644 --- a/src/mongo/db/query/datetime/date_time_support.h +++ b/src/mongo/db/query/datetime/date_time_support.h @@ -421,6 +421,11 @@ public: static TimeZone utcZone(); /** + * Returns a boolean based on if 'timeZoneId' represents a valid timezone. + */ + bool isTimeZoneIdentifier(StringData timeZoneId) const; + + /** * Returns a TimeZone object representing the zone given by 'timeZoneId', or boost::none if it * was not a recognized time zone. */ |