Skip to content

Commit

Permalink
Update Duration and Timestamp (#56)
Browse files Browse the repository at this point in the history
* Update Duration and Timestamp

Fixes: #43

* fix expression
  • Loading branch information
polds authored Jan 9, 2024
1 parent c7b109e commit 3ff590c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,9 @@ examples:

- name: "Duration and timestamp"
expr: |
// Needs Expr translation from CEL. Contributions welcome!
// https://github.com/polds/expr-playground/issues/43
//
// Validate that 'expired' date is after a 'created' date plus a 'ttl' duration
has(object.expired) &&
timestamp(object.created) + duration(object.ttl) < timestamp(object.expired)
"expired" in object &&
date(object.created) + duration(object.ttl) < date(object.expired)
data: |
object:
created: "2023-06-14T02:00:14+00:00"
Expand Down

0 comments on commit 3ff590c

Please sign in to comment.