Rand Stats

DateTime::US

zef:tbrowder

Actions Status

NAME

DateTime::US - Provides time zone (TZ) and daylight saving time (DST) information for US states and territories

SYNOPSIS

use DateTime::US;

DESCRIPTION

Module DateTime::US provides a class and functions used to help Raku programs needing US time zone and DST information. The user creates a DateTime::US object by providing a US time zone abbreviation (note the TZ input abbreviation may be in either format for standard or daylight saving time, e.g., 'CST' or 'CDT'). The list of known data may be listed without an object:

$ raku
> use DateTime::US;
> show-us-data;

The main use case that motivated the module is to convert time in UTC to local time for creating calendars and almanacs. For example, local Sunrise is given in UTC and will normally be shown on a calendar in local time:

my $tz = DateTime.new: :timezone('CST');
my $sunrisez = 2022-10-03T05:45:00Z;
my $localtime = $tz.to-local :utc($sunrisez);

Class methods

Subroutines

SEE ALSO

Todo

Provide handling for the exceptions to use of DST where indicated.

Note

The author is happy to create or collaborate on a similar module for other regions. If interested, simply file an issue or discuss it on IRC #raku (author's handle is 'tbrowder').

AUTHOR

Tom Browder tbrowder@acm.org

COPYRIGHT AND LICENSE

Copyright © 2021-2022 Tom Browder

This library is free software; you may redistribute or modify it under the Artistic License 2.0.