Beispiel #1
0
 def to_value(self, coverage):
     field_value = coverage.get(self.field_name)
     if field_value is None:
         return None
     dt = navitia_utcfromtimestamp(field_value)
     if not dt:
         return NOT_A_DATE_TIME
     return dt.strftime("%Y%m%dT%H%M%S")
Beispiel #2
0
 def to_value(self, coverage):
     tz_name = coverage.get('timezone')
     field_value = coverage.get(self.field_name)
     if not tz_name or field_value is None:
         return None
     dt = navitia_utcfromtimestamp(field_value)
     if not dt:
         return NOT_A_DATE_TIME
     tz = pytz.timezone(tz_name)
     if not tz:
         return None
     dt = pytz.utc.localize(dt)
     dt = dt.astimezone(tz)
     return dt.strftime("%Y%m%dT%H%M%S")
Beispiel #3
0
 def output(self, key, region):
     if 'timezone' in region and key in region:
         dt = navitia_utcfromtimestamp(region[key])
         if not dt:
             return NOT_A_DATE_TIME
         tz = pytz.timezone(region["timezone"])
         if tz:
             dt = pytz.utc.localize(dt)
             dt = dt.astimezone(tz)
             return dt.strftime("%Y%m%dT%H%M%S")
         else:
             return None
     else:
         return None