Skip to content

Date/time value fixes #1387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions general/development/tools/behat/writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,23 @@ When I set the following fields to these values:
When testing plugins with deadlines, for instance for submissions, it is often necessary to set certain time values to dates relative to today.
You can specify a relative time enclosed within two ## blocks. For example:

- `## yesterday ##`
- `## 2 days ago ##`
- `##yesterday##`
- `##2 days ago##`
You can use everything according to http://php.net/manual/en/datetime.formats.php.

Especially useful are the relative formats from: http://php.net/manual/en/datetime.formats.relative.php
Especially useful are the relative formats from: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative

Additionally, you can specify a format you want the date to be returned into:

- `## yesterday ## myformat ##`
These formats can be used as outlined in http://php.net/manual/en/function.date.php.
- `##yesterday##myformat##`
These formats can be used as outlined in https://www.php.net/manual/en/function.strftime.php#refsect1-function.strftime-parameters.
This can be combined with the field groups:

```gherkin
When I set the following fields to these values:
| myDate[day] | ##yesterday##d## |
| myDate[month] | ##yesterday##F## |
| myDate[year] | ##yesterday##Y## |
| myDate[day] | ##yesterday##%d## |
| myDate[month] | ##yesterday##%B## |
| myDate[year] | ##yesterday##%Y## |
```

### Writing your own steps
Expand Down