Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tbrowder/localtime
A clone of class DateTime with different default formatters
https://github.com/tbrowder/localtime
Last synced: 23 days ago
JSON representation
A clone of class DateTime with different default formatters
- Host: GitHub
- URL: https://github.com/tbrowder/localtime
- Owner: tbrowder
- Created: 2022-09-22T13:40:36.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T16:38:17.000Z (11 months ago)
- Last Synced: 2024-12-09T19:50:13.684Z (about 1 month ago)
- Language: Raku
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
[![Actions Status](https://github.com/tbrowder/LocalTime/actions/workflows/linux.yml/badge.svg)](https://github.com/tbrowder/LocalTime/actions) [![Actions Status](https://github.com/tbrowder/LocalTime/actions/workflows/macos.yml/badge.svg)](https://github.com/tbrowder/LocalTime/actions) [![Actions Status](https://github.com/tbrowder/LocalTime/actions/workflows/windows.yml/badge.svg)](https://github.com/tbrowder/LocalTime/actions)
NAME
====**LocalTime** - A wrapper of class **DateTime** with varied formatters depending on time zone entry
SYNOPSIS
========```raku
use LocalTime;
```DESCRIPTION
===========**LocalTime** is a wrapper class holding an instance of the Raku **DateTime** class. It was created to either add a local timezone (TZ) abbreviation to a time string or show either none or other TZ information depending on the use (or non-use) of the named variable `:tz-abbrev`. Following are the formatting effects of the various input conditions:
### class DateTime
* The default format for `DateTime`:
$ say DateTime.new: :2024year;
2024-01-01T00:00:00Z### class LocalTime
* The default format for `LocalTime` with no time zone entry:
$ say LocalTime.new(:2024year);
2024-01-01T00:00:00 # <== note no trailing 'Z'* The default format for `LocalTime` with 'CST' entered:
$ say LocalTime.new(:2024year, :tz-abbrev);
2024-01-01T00:00:00 CST* The format for `LocalTime` with a non-US TZ abbreviation entered:
$ say LocalTime.new(:2024year, :tz-abbrev);
2024-01-01T00:00:00 XYT* The format for `LocalTime` with an empty `:tz-abbrev` named argument entered:
$ say LocalTime.new(:2024year, :tz-abbrev);
2024-01-01T00:00:00 Local Time (UTC -6 hrs)Note for US TZ entries the user can enter either '*st' or '*dt' (case insensitive) and the correct form will be used for the time of year. This module is used to good effect in module `DateTime::US` to get the desired time zone abbreviation in its `.to-localtime` method.
Currently only US abbreviations are in the 'use'd **Timezones::US** database, but a future modification will add others (perhaps in other languages also). PRs are welcome!
AUTHOR
======Tom Browder
COPYRIGHT AND LICENSE
=====================© 2022-2024 Tom Browder
This library is free software; you may redistribute or modify it under the Artistic License 2.0.