Relative dates
DrevOps\BehatSteps\Steps\Web\DateTrait - Source, Example, Helpers
Convert relative date expressions into timestamps or formatted dates.
Supports values and tables.
Possible formats:
[relative:OFFSET][relative:OFFSET#FORMAT]with:
OFFSET: any format that can be parsed bystrtotime().FORMAT:date()format for additional processing.Examples:
[relative:-1 day]converted to1893456000[relative:-1 day#Y-m-d]converted to2017-11-05
dateRelativeProcessValue()is public API. It and its helpers are static, so a token resolves without a context instance.
Late static binding routes the resolution through adateGetNow()override in the composing context. That override is the supported way to hold the current time constant.
Skip processing with tag:@behat-steps-skip:DateTrait.
Options
| Option | Type | Default | Tag | Description |
|---|---|---|---|---|
date.enabled | boolean | TRUE | @behat-steps-skip:DateTrait | If TRUE, replaces [relative:...] tokens in table cells and in the :datetime, :value, :partial_value, :expected_value, :text and :content arguments of a step. If FALSE, tokens stay as written. |