Skip to content
This repository has been archived by the owner on May 23, 2021. It is now read-only.

Timezone check checks both for numerical and letter specification #6

Open
fnielsen opened this issue Nov 22, 2019 · 2 comments
Open

Comments

@fnielsen
Copy link

I do not understand the timezone check (and furthermore, when the data only exists as a date, then I suppose I need to invent a timezone...). Here is the error:

11/22/2019 01:02:15 ERROR: Missing timezone as string from meta date: Fri Nov 22 00:49:17 2019 +0100

Obviously it should matches "matcher_z = re.compile("[+-]\d{4}") # tz offset" but why should it then also match "matcher_Z = re.compile("[A-Z]{3}") # tz name". The format is "%c %z" not "%c %Z %z".

@fnielsen fnielsen changed the title Timezone check Timezone check checks both for numerical and letter specification Nov 22, 2019
@hvingelby
Copy link

I agree. There is a mismatch between the validator and the guidelines that says %c %z.

@JensMadsen
Copy link

Why not use UTC ISO 8601? No confusion and supported in all languages out of the box with no coding necessary. In Python you get an ISO formatted datetime string by:

iso_format_datetime_string: str = datetime.now(timezone.utc).isoformat() 

To check if a datetime string is correct isoformat do:

try:
    iso_format_datetime = datetime.fromisoformat(iso_format_datetime_string: str)  
except ValueError:
    print('time to handle error :-) ')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants