Coder Social home page Coder Social logo

Comments (5)

dhomeier avatar dhomeier commented on August 16, 2024

Where did you get from that 'US/Aleutian' is at UTC-9?
NIST only recognises a 'Hawaii-Aleutian Time', which is HST at UTC-10 – although the Aleutian Islands have a daylight saving time HDT at UTC-9, but that is not a geographical timezone. UTC-9 is Alaskan (AKST).
https://www.nist.gov/pml/time-and-frequency-division/local-time-faqs#zones

The current designation is somewhat misleading (for all 8 Mauna Kea and Haleakala sites), but it does not look like there is an incorrect TZ offset inferred from it anywhere.

from astropy-data.

shbhuk avatar shbhuk commented on August 16, 2024

As follows -

import datetime, pytz
print(datetime.datetime.now(pytz.timezone("US/Aleutian")).utcoffset().total_seconds()/60/60)

Prints -9.0

from astropy-data.

shbhuk avatar shbhuk commented on August 16, 2024

I think the problem might be highlighted in the NIST URL you shared here -
image

from astropy-data.

dhomeier avatar dhomeier commented on August 16, 2024

Yes; and the pytz designation being at least arguably confusing – this is obviously switching automatically to DST for 'US/Aleutian' when applicable:

>>> utc_now = datetime.datetime(2021, 9, 18, 19, 0, 0, tzinfo=pytz.timezone('UTC'))
>>> utc_now.astimezone(pytz.timezone('US/Aleutian'))
datetime.datetime(2021, 9, 18, 10, 0, tzinfo=<DstTzInfo 'US/Aleutian' HDT-1 day, 15:00:00 DST>)
>>> utc_now.astimezone(pytz.timezone('US/Hawaii'))
datetime.datetime(2021, 9, 18, 9, 0, tzinfo=<DstTzInfo 'US/Hawaii' HST-1 day, 14:00:00 STD>)
>>> utc_now.astimezone(pytz.timezone('HST'))
datetime.datetime(2021, 9, 18, 9, 0, tzinfo=<StaticTzInfo 'HST'>)
>>> utc_thx = datetime.datetime(2021, 11, 25, 12, 0, 0, tzinfo=pytz.timezone('UTC'))
>>> utc_thx.astimezone(pytz.timezone('US/Aleutian'))
datetime.datetime(2021, 11, 25, 2, 0, tzinfo=<DstTzInfo 'US/Aleutian' HST-1 day, 14:00:00 STD>)
>>> utc_thx.astimezone(pytz.timezone('US/Hawaii'))
datetime.datetime(2021, 11, 25, 2, 0, tzinfo=<DstTzInfo 'US/Hawaii' HST-1 day, 14:00:00 STD>)
>>> utc_thx.astimezone(pytz.timezone('HST'))
datetime.datetime(2021, 11, 25, 2, 0, tzinfo=<StaticTzInfo 'HST'>)

Clearly it would be preferable to use the official TZ abbreviations throughout.

EDIT: from the tz database and e.g. https://home.kpn.nl/vanadovv/time/Multizones.html
'Aleutian' and 'Hawaii' are at least semi-officially denoting the parts observing/not observing DST; so there is a point in using them as they provide both information on the DST rules and the BaseTz/StaticTz. The correct one then of course is 'US/Hawaii'.

from astropy-data.

dhomeier avatar dhomeier commented on August 16, 2024

I am volunteering to fix the entries in a PR, preferably after consensus about a consistent format has been reached.
I must say that pytz's treatment of the different formats is somewhat bewildering, e.g.

>>> datetime.datetime.now(pytz.timezone('US/Eastern'))
datetime.datetime(2021, 10, 9, 14, 49, 39, 25761, tzinfo=<DstTzInfo 'US/Eastern' EDT-1 day, 20:00:00 DST>)
>>> datetime.datetime.now(pytz.timezone('EST'))
datetime.datetime(2021, 10, 9, 13, 50, 1, 567091, tzinfo=<StaticTzInfo 'EST'>)
>>> datetime.datetime.now(pytz.timezone('US/Mountain'))
datetime.datetime(2021, 10, 9, 11, 50, 13, 203518, tzinfo=<DstTzInfo 'US/Mountain' MDT-1 day, 18:00:00 DST>)
>>> datetime.datetime.now(pytz.timezone('MST'))
datetime.datetime(2021, 10, 9, 10, 50, 21, 434496, tzinfo=<StaticTzInfo 'MST'>)

whereas for the European timezones

>>> datetime.datetime.now(pytz.timezone('Europe/Paris'))
datetime.datetime(2021, 10, 9, 20, 50, 33, 594535, tzinfo=<DstTzInfo 'Europe/Paris' CEST+2:00:00 DST>)
>>> datetime.datetime.now(pytz.timezone('CET'))
datetime.datetime(2021, 10, 9, 20, 50, 46, 475846, tzinfo=<DstTzInfo 'CET' CEST+2:00:00 DST>)

and CST, PST are not accepted at all...
That means replacing CET with Europe/Capital would probably have no practical effect (unless we had an entry for Europe/Zurich in the summer of 1980...), but still be more easily recognisable IMO.

from astropy-data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.