-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: draft
Are you sure you want to change the base?
Changes from all commits
0782ad9
d12d479
1aaaae1
b7f125f
a05985b
72a639f
c8b4691
cd51493
57427cc
4a7ed9d
fab0d95
5d5a50f
5391a6a
e2a2793
9743439
770962a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is day of week Monday or Sunday based? Does it start with 0 or 1? Does it return numbers or strings? |
||
"day of year", | ||
"week", | ||
"week number", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zero or one based? What's the difference between week and 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 | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description needs to be made much more precise with regards to value ranges for example. See comments below.