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")
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")
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