NAME
Sah::Schemas::Date - Sah schemas related to date
VERSION
This document describes version 0.018 of Sah::Schemas::Date (from Perl
distribution Sah-Schemas-Date), released on 2022-10-12.
SYNOPSIS
SAH SCHEMAS
The following schemas are included in this distribution:
* date::day
Day of month (1-31), e.g. 17.
* date::dow_name::en
Day-of-week name (abbreviated or full, in English), e.g. "su" or
"Monday".
See also: Sah::Schema::date::dow_num.
See also related schemas for other locales, e.g.
Sah::Schema::date::dow_name::id (Indonesian),
Sah::Schema::date::dow_name::en_or_id (English/Indonesian), etc.
* date::dow_num
Day-of-week number (1-7, 1=Monday, like DateTime), coercible from
English day-of-week name (Mo/mon/MONDAY), e.g. 1 or "Mon".
See also related schemas that coerce from other locales, e.g.
Sah::Schema::date::dow_num::id (Indonesian),
Sah::Schema::date::dow_num::en_or_id (English/Indonesian), etc.
* date::dow_nums
Array of required date::dow_num (day-of-week, 1-7, 1=Monday, like
DateTime, with coercions), e.g. [1,3,5].
See also Sah::Schema::date::dow_num which is the schema for the
elements.
See also related schemas that coerce from other locales, e.g.
Sah::Schema::date::dow_nums::id (Indonesian),
Sah::Schema::date::dow_num::en_or_id (English/Indonesian), etc.
* date::hour
Hour of day (0-23), e.g. 12.
* date::minute
Minute of hour (0-59), e.g. 30.
* date::month::en
Month number/name (abbreviated or full, in English), e.g. 1 or "jan"
or "September".
Note that name is not coerced to number; use
Sah::Schema::date::month_num::id for that.
See also related schemas for other locales, e.g.
Sah::Schema::date::month::id (Indonesian),
Sah::Schema::date::month::en_or_id (English/Indonesian), etc.
* date::month_name::en
Month name (abbreviated or full, in English), e.g. jan or
"September".
See also: Sah::Schema::date::month_num.
See also related schemas for other locales, e.g.
Sah::Schema::date::month_name::id (Indonesian),
Sah::Schema::date::month_name::en_or_id (English/Indonesian), etc.
* date::month_num
Month number, coercible from English month names (Dec/DECEMBER),
e.g. 2 or "Feb".
See also related schemas that coerce from other locales, e.g.
Sah::Schema::date::month_num::id (Indonesian),
Sah::Schema::date::month_num::en_or_id (English/Indonesian), etc.
* date::month_nums
Array of required month numbers (1-12, with coercions), e.g. [6,12].
See also related schemas that coerce from other locales, e.g.
Sah::Schema::date::month_nums::id (Indonesian),
Sah::Schema::date::month_nums::en_or_id (English/Indonesian), etc.
* date::second
Second of minute (0-60), e.g. 39.
* date::tz_name
Timezone name (validity not checked), e.g. Asia/Jakarta.
Currently no validation for valid timezone names. But completion is
provided.
* date::tz_offset
Timezone offset in seconds from UTC (only known offsets are allowd,
coercible from string), e.g. 25200 or "+07:00".
Only timezone offsets that are known to exist are allowed. For
example, 1 second (+00:00:01) is not allowed. See
"date::tz_offset_lax" for a more relaxed validation.
A coercion from these form of string is provided:
UTC
UTC-14 or UTC+12 or UTC+12:45 or UTC-00:25:21
-14 or +12, -1400 or +12:00
A coercion from timezone name is also provided.
* date::tz_offset_lax
Timezone offset in seconds from UTC (any offset is allowed,
coercible from string), e.g. 1 or 25200 e.g. UTC+7.
This schema allows timezone offsets that are not known to exist,
e.g. 1 second (+00:00:01). If you only want ot allow timezone
offsets that are known to exist, see the "date::tz_offset" schema.
A coercion from these form of string is provided:
UTC
UTC-14 or UTC+12 or UTC+12:45 or UTC-00:25:21
-14 or +12, -1400 or +12:00
A coercion from timezone name is also provided.
* date::year
Year number (AD, starting from 1), e.g. 2022.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Sah-Schemas-Date>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-Sah-Schemas-Date>.
SEE ALSO
Data::Sah::Type::date
Sah - schema specification
Data::Sah - Perl implementation of Sah
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull
requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You
can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally
on your system), you can install Dist::Zilla,
Dist::Zilla::PluginBundle::Author::PERLANCAR,
Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2022, 2020, 2019 by perlancar
<perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Sah-Schemas-Date>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.