NAME
dateseq-idn - Like dateseq, but with built-in support for Indonesian holidays
VERSION
This document describes version 0.004 of dateseq-idn (from Perl distribution App-dateseq-idn), released on 2021-03-09.
SYNOPSIS
Usage:
% dateseq-idn [--business] [--business6] [--exclude-dow-json=s]
[--exclude-dow=s+] [--exclude-joint-leave] [--exclude-month-json=s]
[--exclude-month=s+] [-f=s] [--format-class-attrs-json=s]
[--format-class-attrs=s] [--format-class=s] [--format=name]
[--header=s] [--holiday] [--include-dow-json=s] [--include-dow=s+]
[--include-joint-leave] [--include-month-json=s] [--include-month=s+]
[-j] [--json] [--limit-monthly=s] [--limit-yearly=s] [--limit=s]
[-n=s] [--(no)naked-res] [--no-business] [--no-business6]
[--no-holiday] [--nobusiness] [--nobusiness6] [--noholiday]
[--page-result[=program]] [-r] [--reverse] [--strftime=s]
[--view-result[=program]] [from] [to] [increment]
Examples:
List Indonesian holidays between 2020-01-01 to 2021-12-31:
% dateseq-idn 2020-01-01 2021-12-13 --holiday
List the last non-holiday business day of each month in 2021:
% dateseq-idn 2021-12-31 2021-01-01 -r --noholiday -j --business --limit-monthly 1
DESCRIPTION
This utility is a wrapper for dateseq, with builtin support for Indonesian holidays (data from Calendar::Indonesia::Holiday). It offers additional --holiday (and --noholiday, as well as -j) options to let you filter dates based on whether they are Indonesian holidays.
OPTIONS
*
marks required options.
Main options
- --from=s
-
Starting date.
- --header=s
-
Add a header row.
- --increment=s, -i
- --limit-monthly=s
-
Only output at most this number of dates for each month.
- --limit-yearly=s
-
Only output at most this number of dates for each year.
- --limit=s, -n
-
Only generate a certain amount of numbers.
- --reverse, -r
-
Decrement instead of increment.
- --to=s
-
End date, if not specified will generate an infinite* stream of dates.
Filtering options
- --business
-
Only list business days (Mon-Fri), or non-business days.
- --business6
-
Only list business days (Mon-Sat), or non-business days.
- --exclude-dow-json=s
-
Do not show dates with these day-of-weeks (JSON-encoded).
See
--exclude-dow
. - --exclude-dow=s@
-
Do not show dates with these day-of-weeks.
Can be specified multiple times.
- --exclude-month-json=s
-
Do not show dates with these month numbers (JSON-encoded).
See
--exclude-month
. - --exclude-month=s@
-
Do not show dates with these month numbers.
Can be specified multiple times.
- --holiday
-
Only list holidays (or non-holidays).
- --include-dow-json=s
-
Only show dates with these day-of-weeks (JSON-encoded).
See
--include-dow
. - --include-dow=s@
-
Only show dates with these day-of-weeks.
Can be specified multiple times.
- --include-joint-leave, -j
-
Whether to assume joint leave days as holidays.
- --include-month-json=s
-
Only show dates with these month numbers (JSON-encoded).
See
--include-month
. - --include-month=s@
-
Only show dates with these month numbers.
Can be specified multiple times.
Formatting options
- --format-class-attrs-json=s
-
Arguments to pass to constructor of DateTime::Format::* class (JSON-encoded).
See
--format-class-attrs
. - --format-class-attrs=s
-
Arguments to pass to constructor of DateTime::Format::* class.
- --format-class=s
-
Use a DateTime::Format::* class for formatting.
By default, <pm:DateTime::Format::Strptime> is used with pattern set from the <strftime> option.
- --strftime=s, -f
-
strftime() format for each date.
Default is `%Y-%m-%d`, unless when hour/minute/second is specified, then it is `%Y-%m-%dT%H:%M:%S`.
`dateseq` actually uses <pm:DateTimeX::strftimeq>, so you can embed Perl code for flexibility. For example:
% dateseq 2019-11-19 2019-11-25 -f '%Y-%m-%d%( $_->day_of_week == 7 ? "su" : "" )q'
will print something like:
2019-11-19 2019-11-20 2019-11-21 2019-11-22 2019-11-23 2019-11-24su 2019-11-25
Output options
- --format=s
-
Choose output format, e.g. json, text.
Default value:
undef
- --json
-
Set output format to json.
- --naked-res
-
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,"OK",[1,2,3],{"func.extra"=>4}]
The reason is so you can get the status (1st element), status message (2nd element) as well as result metadata/extra result (4th element) instead of just the result (3rd element). However, sometimes you want just the result, e.g. when you want to pipe the result for more post-processing. In this case you can use `--naked-res` so you just get:
[1,2,3]
- --page-result
-
Filter output through a pager.
- --view-result
-
View output using a viewer.
Other options
COMPLETION
This script has shell tab completion capability with support for several shells.
bash
To activate bash completion for this script, put:
complete -C dateseq-idn dateseq-idn
in your bash startup (e.g. ~/.bashrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is recommended, however, that you install modules using cpanm-shcompgen which can activate shell completion for scripts immediately.
tcsh
To activate tcsh completion for this script, put:
complete dateseq-idn 'p/*/`dateseq-idn`/'
in your tcsh startup (e.g. ~/.tcshrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is also recommended to install shcompgen (see above).
other shells
For fish and zsh, install shcompgen as described above.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-dateseq-idn.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-dateseq-idn.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-App-dateseq-idn/issues
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.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by 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.