opendate 0.1.6__tar.gz → 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of opendate might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opendate
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Python business datetimes
5
5
  Home-page: https://github.com/bissli/opendate
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "opendate"
3
- version = "0.1.6"
3
+ version = "0.1.8"
4
4
  description = "Python business datetimes"
5
5
  authors = ["bissli <bissli.xyz@protonmail.com>"]
6
6
  readme = "README.md"
@@ -1,4 +1,4 @@
1
- __version__ = '0.1.6'
1
+ __version__ = '0.1.8'
2
2
 
3
3
  import datetime as _datetime
4
4
 
@@ -1068,6 +1068,21 @@ class Time(_pendulum.Time):
1068
1068
 
1069
1069
  return cls(obj.hour, obj.minute, obj.second, obj.microsecond, tzinfo=tz)
1070
1070
 
1071
+ def in_timezone(self, tz: str | _zoneinfo.ZoneInfo | _datetime.tzinfo):
1072
+ """Convert timezone
1073
+
1074
+ >>> Time(12, 0).in_timezone(Timezone('America/Sao_Paulo'))
1075
+ Time(9, 0, 0, tzinfo=Timezone('America/Sao_Paulo'))
1076
+
1077
+ >>> Time(12, 0, tzinfo=Timezone('Europe/Moscow')).in_timezone(Timezone('America/Sao_Paulo'))
1078
+ Time(6, 0, 0, tzinfo=Timezone('America/Sao_Paulo'))
1079
+
1080
+ """
1081
+ _dt = DateTime.combine(Date.today(), self, tzinfo=self.tzinfo or UTC)
1082
+ return _dt.in_timezone(tz).time()
1083
+
1084
+ in_tz = in_timezone
1085
+
1071
1086
 
1072
1087
  class DateTime(DateBusinessMixin, _pendulum.DateTime):
1073
1088
  """Inherits and wraps pendulum.DateTime
File without changes
File without changes
File without changes