ISO Date Formatter for Tartiflette
Project description
tartiflette-plugin-isodatenow
ISO Date Format Directive for Tartiflette
TOC
Overview
The tartiflette-plugin-isodatenow plugin adds an @isoDateNow directive to tartiflette. It sets the field that it is on with the current time in ISO 8601 format.
It is primarly intended for use in mutations as the directive overrides any value sent though it can be used in queries where a createdAt or response timestamp is required.
Installation
To install with poetry:
$ poetry add tartiflette-plugin-isodatenow
To install with pip:
$ pip install tartiflette-plugin-isodatenow
Usage
type Example {
createdAt: String @isoDateNow
}
Querying createdAt would return the following:
{
"data": {
"example": {
"createdAt": "2019-09-04T13:49:12.585158+00:00"
}
}
}
Options
The @isoDateNow also takes the following optional arguments:
@isoDateNow(microseconds: false)
Returns date and time without microseconds.
type Example {
createdAt: String @isoDateNow(microseconds: false)
}
Querying createdAt would return the following:
{
"data": {
"example": {
"createdAt": "2019-09-04T13:49:12+00:00"
}
}
}
@isoDateNow(timezone: false)
Returns date and time without timezone.
type Example {
createdAt: String @isoDateNow(timezone: false)
}
Querying createdAt would return the following:
{
"data": {
"example": {
"createdAt": "2019-09-04T13:49:12.585158"
}
}
}
@isoDateNow(utc: false)
Returns date and time in the local timezone.
type Example {
createdAt: String @isoDateNow(utc: false)
}
Querying createdAt would return the following:
{
"data": {
"example": {
"createdAt": "2019-09-04T09:49:12.585158-04:00"
}
}
}
The arguments can be used in any combination and will return an ISO8601 compliant date.
For example settings microseconds to false and timezone to true would yield: 2019-09-04T13:49:12+00:00.
Possible combinations:
@isoDateNow>> "2019-09-04T13:49:12.585158+00:00"@isoDateNow(timezone: false)>> "2019-09-04T13:52:43.476260"@isoDateNow(microseconds: false)>> "2019-09-04T13:50:02+00:00"@isoDateNow(microseconds: false, timezone: false)>> "2019-09-04T13:53:31"
The time can also be set to the local time by setting utc to false.
@isoDateNow(utc: false) >> "2019-09-04T09:50:02+00:00"
Using the @isoDateNow directive will override any value sent.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tartiflette-plugin-isodatenow-0.2.2.tar.gz.
File metadata
- Download URL: tartiflette-plugin-isodatenow-0.2.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83c54be71e8d04adc198bea14d46530068433c76ee2c00d815878179302e3681
|
|
| MD5 |
21587b86843a9f0cf68a74f8f661e568
|
|
| BLAKE2b-256 |
a0e30934affcbfc2347dca4781210f372f5cf45ef0575341ef00ef6adfef49cf
|
File details
Details for the file tartiflette_plugin_isodatenow-0.2.2-py3-none-any.whl.
File metadata
- Download URL: tartiflette_plugin_isodatenow-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d778af0d82ba6e2a5a93264277dd1bbee322a497740767fe9b1fa17405dd3d1
|
|
| MD5 |
fc3e317c1dbeea3484ecf74c3d6fc400
|
|
| BLAKE2b-256 |
1e3ddf2a5138a877508c7141af859da79f263805573252dbed0988c9022b24ee
|