diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d268dd9..d1a2f110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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_component` + - `date_replace_component` - `filter_vector` - `flatten_dimensions` - `load_geojson` diff --git a/meta/implementation.md b/meta/implementation.md index 65a24430..4b6c604c 100644 --- a/meta/implementation.md +++ b/meta/implementation.md @@ -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. diff --git a/proposals/date_get_component.json b/proposals/date_get_component.json new file mode 100644 index 00000000..5013a16e --- /dev/null +++ b/proposals/date_get_component.json @@ -0,0 +1,83 @@ +{ + "id": "date_get_component", + "summary": "Gets a part/component of a date", + "description": "Retrieves a specified portion of a given date.\nIt enables the extraction of specific details from a date, such as year, month, or day.", + "categories": [ + "date & time" + ], + "experimental": true, + "parameters": [ + { + "name": "date", + "description": "The date (and optionally time) to get a part of.", + "schema": [ + { + "type": "string", + "format": "date-time", + "subtype": "date-time" + }, + { + "type": "string", + "format": "date", + "subtype": "date" + } + ] + }, + { + "name": "component", + "description": "The component for the value given. The following pre-defined components 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- day of week: Day of Week\n- day of year: Day of Year\n- week: Weeks (equivalent to 7 days)\n- week number: Week Number\n- month: Months\n- year: Years\n\nReplacements with the component `year`, `month` or `day` do never change the time.", + "schema": { + "type": "string", + "enum": [ + "millisecond", + "second", + "minute", + "hour", + "day", + "day of week", + "day of year", + "week", + "week number", + "month", + "year" + ] + } + } + ], + "returns": { + "description": "Returns retrieved portion of a date.", + "schema": { + "type": "number" + } + }, + "examples": [ + { + "arguments": { + "date": "2023-02-01T17:22:45Z", + "component": "month" + }, + "returns": 2 + }, + { + "arguments": { + "date": "2023-03-31T00:00:00+02:00", + "component": "day" + }, + "returns": 31 + }, + { + "arguments": { + "date": "2023-01-01", + "component": "year" + }, + "returns": 2023 + }, + { + "arguments": { + "date": "2023-01-01", + "component": "month" + }, + "returns": 1 + } + ] +} \ No newline at end of file diff --git a/proposals/date_replace_component.json b/proposals/date_replace_component.json new file mode 100644 index 00000000..761b4985 --- /dev/null +++ b/proposals/date_replace_component.json @@ -0,0 +1,108 @@ +{ + "id": "date_replace_component", + "summary": "Replaces a part of a date", + "description": "Replaces a part of a given date string with a new value based on the provided component, allowing for easy replacing of dates.\n\nIn case a date/time overflow, the component will be clipped to their respective bounds e.g. if hour is set to 27, it can be clipped to 23. Similarly, if day is set to -40, it can be clipped to the first day of the month.", + "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": "component", + "description": "The component for the value given. The following pre-defined components 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 component `year`, `month` or `day` do never change the time.", + "schema": { + "type": "string", + "enum": [ + "millisecond", + "second", + "minute", + "hour", + "day", + "month", + "year" + ] + } + }, + { + "name": "value", + "description": "The period of time in the component given to replace the existing value.", + "schema": { + "type": "integer" + } + } + ], + "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. If the date parameter only includes a date component and a time component is replaced, the resulting output will include the time component as well.", + "schema": [ + { + "type": "string", + "format": "date-time", + "subtype": "date-time" + }, + { + "type": "string", + "format": "date", + "subtype": "date" + } + ] + }, + "examples": [ + { + "arguments": { + "date": "2020-02-01T17:22:45Z", + "component": "month", + "value": 6 + }, + "returns": "2020-06-01T17:22:45Z" + }, + { + "arguments": { + "date": "2021-03-31T00:00:00+02:00", + "component": "day", + "value": 7 + }, + "returns": "2021-03-07T00:00:00+02:00" + }, + { + "arguments": { + "date": "2018-01-01", + "component": "year", + "value": 2023 + }, + "returns": "2023-01-01" + }, + { + "arguments": { + "date": "2018-01-01", + "component": "month", + "value": 5 + }, + "returns": "2017-05-01" + }, + { + "description": "A date overflow is clipped to the respective bound of the date component.", + "arguments": { + "date": "2023-01-30", + "component": "day", + "value": -40 + }, + "returns": "2023-01-01" + } + ] +} \ No newline at end of file