Skip to content
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

Date replace and Date get #433

Open
wants to merge 16 commits into
base: draft
Choose a base branch
from
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- New processes in proposal state:
- `date_difference`
- `date_get`
- `date_replace`
- `filter_vector`
- `flatten_dimensions`
- `load_geojson`
Expand Down
2 changes: 1 addition & 1 deletion meta/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ options that can be passed to the corresponsing `methods`:
- `athmospheric_correction`: `options`
- `cloud_detection`: `options`

By default, the parameters don't allow any value except an empty opject.
By default, the parameters don't allow any value except an empty object.
Back-ends have to either remove the parameter or define schema to give user
details about the supported parameters per supported method.

Expand Down
81 changes: 81 additions & 0 deletions proposals/date_get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"id": "date_get",
"summary": "Gets a part of a date",
"description": "Retrieves a specified portion of a given date object.\n It enables the extraction of specific details from a date object, such as year, month, or day.",
"categories": [
"date & time"
],
"experimental": true,
"parameters": [
{
"name": "date",
"description": "The date (and optionally time) to to get a part of.",
"schema": [
{
"type": "string",
"format": "date-time",
"subtype": "date-time"
},
{
"type": "string",
"format": "date",
"subtype": "date"
}
]
},
{
"name": "unit",
"description": "The unit for the value given. The following pre-defined units are available:\n\n- millisecond: Milliseconds\n- second: Seconds .\n- minute: Minutes\n- hour: Hours\n- day: Days - changes only the the day part of a date\n- month: Months\n- year: Years\n\nReplacements with the unit `year`, `month` or `day` do never change the time.",
"schema": {
"type": "string",
"enum": [
"millisecond",
"second",
"minute",
"hour",
"day",
"month",
"year"
]
}
}
],
"returns": {
"description": "Returns retrieved portion of a date.",
"schema": {
"type": [
"number"
]
}
},
"examples": [
{
"arguments": {
"date": "2023-02-01T17:22:45Z",
"unit": "month"
},
"returns": "02"
},
{
"arguments": {
"date": "2023-03-31T00:00:00+02:00",
"unit": "day"
},
"returns": "31"
},
{
"arguments": {
"date": "2023-01-01",
"unit": "year"
},
"returns": "2023"
},
{
"arguments": {
"date": "2023-01-01",
"unit": "month"
},
"returns": "01"
}
]
}
99 changes: 99 additions & 0 deletions proposals/date_replace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"id": "date_replace",
"summary": "Replaces a part of a date",
"description": "Replaces a part of a given date string with a new value based on the provided unit, allowing for easy replacing of dates.",
"categories": [
"date & time"
],
"experimental": true,
"parameters": [
{
"name": "date",
"description": "The date (and optionally time) to replace.\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 to replace the existing value.",
"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 .\n- minute: Minutes\n- hour: Hours\n- day: Days - changes only the the day part of a date\n- month: Months\n- year: Years\n\nReplacements with the unit `year`, `month` or `day` do never change the time.",
"schema": {
"type": "string",
"enum": [
"millisecond",
"second",
"minute",
"hour",
"day",
"month",
"year"
]
}
}
],
"returns": {
"description": "The date with replaced value. 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-06-01T17:22:45Z"
},
{
"arguments": {
"date": "2021-03-31T00:00:00+02:00",
"value": 7,
"unit": "day"
},
"returns": "2021-03-07T00:00:00+02:00"
},
{
"arguments": {
"date": "2018-01-01",
"value": 2023,
"unit": "year"
},
"returns": "2023-01-01"
},
{
"arguments": {
"date": "2018-01-01",
"value": 5,
"unit": "month"
},
"returns": "2017-05-01"
}
]
}