Skip to content

Commit

Permalink
support up to years
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
  • Loading branch information
Lawouach committed Jan 18, 2024
1 parent c9376b7 commit d6dec54
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

## [Unreleased][]

[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-aws/compare/0.29.0...HEAD
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-aws/compare/0.29.1...HEAD

## [0.29.1][] - 2024-01-18

[0.29.1]: https://github.com/chaostoolkit-incubator/chaostoolkit-aws/compare/0.29.0...0.29.1

### Added

- Offset supported to months and years

## [0.29.0][] - 2023-12-10

Expand Down
9 changes: 8 additions & 1 deletion chaosaws/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from chaoslib.types import Configuration, DiscoveredActivities, Discovery, Secrets
from logzero import logger

__version__ = "0.29.0"
__version__ = "0.29.1"
__all__ = ["__version__", "discover", "aws_client", "signed_api_call"]


Expand Down Expand Up @@ -286,6 +286,13 @@ def time_to_datetime(
delta = 60 * 60
elif unit in ("day", "days"):
delta = 60 * 60 * 24
elif unit in ("month", "months"):
delta = 60 * 60 * 24 * 30
elif unit in ("year", "years"):
delta = 60 * 60 * 24 * 365
else:
# let's default to the last 5mn
delta = 300

return offset - timedelta(seconds=duration * delta)

Expand Down

0 comments on commit d6dec54

Please sign in to comment.