@@ -58,18 +58,18 @@ static Converter()
58
58
timeSpanCtor = Runtime . PyObject_GetAttrString ( dateTimeMod , "timedelta" ) ;
59
59
if ( timeSpanCtor == null ) throw new PythonException ( ) ;
60
60
61
- IntPtr tzInfoMod = PythonEngine . ModuleFromString ( "custom_tzinfo" ,
62
- " from datetime import timedelta, tzinfo\n " +
63
- " class GMT(tzinfo):\n " +
64
- " def __init__(self, hours, minutes):\n " +
65
- " self.hours = hours\n " +
66
- " self.minutes = minutes\n " +
67
- " def utcoffset(self, dt):\n " +
68
- " return timedelta(hours=self.hours, minutes=self.minutes)\n " +
69
- " def tzname(self, dt):\n " +
70
- " return \" GMT {0 :00}:{1:00} \" .format( self.hours, self. minutes) \n " +
71
- " def dst (self, dt):\n " +
72
- " return timedelta(0)\n ") . Handle ;
61
+ IntPtr tzInfoMod = PythonEngine . ModuleFromString ( "custom_tzinfo" , @"
62
+ from datetime import timedelta, tzinfo
63
+ class GMT(tzinfo):
64
+ def __init__(self, hours, minutes):
65
+ self.hours = hours
66
+ self.minutes = minutes
67
+ def utcoffset(self, dt):
68
+ return timedelta(hours=self.hours, minutes=self.minutes)
69
+ def tzname(self, dt):
70
+ return f' GMT {self.hours :00}:{self.minutes:00}'
71
+ def dst (self, dt):
72
+ return timedelta(0)" ) . Handle ;
73
73
74
74
tzInfoCtor = Runtime . PyObject_GetAttrString ( tzInfoMod , "GMT" ) ;
75
75
if ( tzInfoCtor == null ) throw new PythonException ( ) ;
@@ -904,7 +904,7 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
904
904
goto type_error ;
905
905
}
906
906
Runtime . XDecref ( op ) ;
907
- result = dt ;
907
+ result = sdt . EndsWith ( "+00:00" ) ? dt . ToUniversalTime ( ) : dt ;
908
908
return true ;
909
909
default :
910
910
goto type_error ;
0 commit comments