forked from Open-EO/openeo-processes
-
Notifications
You must be signed in to change notification settings - Fork 4
/
date_shift.json
136 lines (136 loc) · 5.48 KB
/
date_shift.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
"id": "date_shift",
"summary": "Manipulates dates and times by addition or subtraction",
"description": "Based on a given date (and optionally time), calculates a new date (and time if given) by adding or subtracting a given temporal period.\n\nSome specifics about dates and times need to be taken into account:\n\n* This process doesn't have any effect on the time zone.\n* It doesn't take daylight saving time (DST) into account as only dates and times in UTC (with potential numerical time zone modifier) are supported.\n* Leap years are implemented in a way that computations handle them gracefully (see parameter `unit` for details).\n* Leap seconds are mostly ignored in manipulations as they don't follow a regular pattern. Leap seconds can be passed to the process, but will never be returned.",
"categories": [
"date & time"
],
"experimental": true,
"parameters": [
{
"name": "date",
"description": "The date (and optionally time) to manipulate.\n\nIf the given date doesn't include the time, the process assumes that the time component is `00:00:00Z` (i.e. midnight, in UTC). The millisecond part of the time is optional and defaults to `0` if not given.",
"schema": [
{
"type": "string",
"format": "date-time",
"subtype": "date-time"
},
{
"type": "string",
"format": "date",
"subtype": "date"
}
]
},
{
"name": "value",
"description": "The period of time in the unit given that is added (positive numbers) or subtracted (negative numbers). The value `0` doesn't have any effect.",
"schema": {
"type": "integer"
}
},
{
"name": "unit",
"description": "The unit for the value given. The following pre-defined units are available:\n\n- millisecond: Milliseconds\n- second: Seconds - leap seconds are ignored in computations.\n- minute: Minutes\n- hour: Hours\n- day: Days - changes only the the day part of a date\n- week: Weeks (equivalent to 7 days)\n- month: Months\n- year: Years\n\nManipulations with the unit `year`, `month`, `week` or `day` do never change the time. If any of the manipulations result in an invalid date or time, the corresponding part is rounded down to the next valid date or time respectively. For example, adding a month to `2020-01-31` would result in `2020-02-29`.",
"schema": {
"type": "string",
"enum": [
"millisecond",
"second",
"minute",
"hour",
"day",
"week",
"month",
"year"
]
}
}
],
"returns": {
"description": "The manipulated date. If a time component was given in the parameter `date`, the time component is returned with the date.",
"schema": [
{
"type": "string",
"format": "date-time",
"subtype": "date-time"
},
{
"type": "string",
"format": "date",
"subtype": "date"
}
]
},
"examples": [
{
"arguments": {
"date": "2020-02-01T17:22:45Z",
"value": 6,
"unit": "month"
},
"returns": "2020-08-01T17:22:45Z"
},
{
"arguments": {
"date": "2021-03-31T00:00:00+02:00",
"value": -7,
"unit": "day"
},
"returns": "2021-03-24T00:00:00+02:00"
},
{
"description": "Adding a year to February 29th in a leap year will result in February 28th in the next (non-leap) year.",
"arguments": {
"date": "2020-02-29T17:22:45Z",
"value": 1,
"unit": "year"
},
"returns": "2021-02-28T17:22:45Z"
},
{
"description": "Adding a month to January 31th will result in February 29th in leap years.",
"arguments": {
"date": "2020-01-31",
"value": 1,
"unit": "month"
},
"returns": "2020-02-29"
},
{
"description": "The process skips over the leap second `2016-12-31T23:59:60Z`.",
"arguments": {
"date": "2016-12-31T23:59:59Z",
"value": 1,
"unit": "second"
},
"returns": "2017-01-01T00:00:00Z"
},
{
"description": "Milliseconds can be added or subtracted. If not given, the default value is `0`.",
"arguments": {
"date": "2018-12-31T17:22:45Z",
"value": 1150,
"unit": "millisecond"
},
"returns": "2018-12-31T17:22:46.150Z"
},
{
"arguments": {
"date": "2018-01-01",
"value": 25,
"unit": "hour"
},
"returns": "2018-01-02"
},
{
"arguments": {
"date": "2018-01-01",
"value": -1,
"unit": "hour"
},
"returns": "2017-12-31"
}
]
}