1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/plugins/filter/to_years.yml
Felix Fontein f055f47161
Document all filter and test plugins (#4597)
* Fix/improve docs.

* Document the a_module test.

* Document the dict filter.

* Linting.

* Add more filter docs.

* More filters.

* Update BOTMETA.

* Add another plugin.

* Fix typos.

* Add explicit entries.

* Fix lookup documentation.
2022-05-02 07:25:45 +02:00

40 lines
1.3 KiB
YAML

DOCUMENTATION:
name: to_years
short_description: Converte a duration string to years
version_added: 0.2.0
description:
- Parse a human readable time duration string and convert to years.
options:
_input:
description:
- The time string to convert.
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
can be added to a unit as well, so C(seconds) is the same as C(second).
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
type: string
required: true
year:
description:
- Number of days per year.
default: 365
type: float
month:
description:
- Number of days per month.
default: 30
type: float
author:
- René Moser (@resmo)
EXAMPLES: |
- name: Convert a duration into years
ansible.builtin.debug:
msg: "{{ '1053d 30h' | community.general.to_years }}"
RETURN:
_value:
description: Number of years.
type: float