Skip to content

Commit 5e5ac42

Browse files
committed
add Expressing Date / Datetime / Timezone information to readme
Signed-off-by: Diego Carvallo <dccakes@gmail.com>
1 parent 48d2d3d commit 5e5ac42

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,44 @@ Additional metadata options to more accurately define the data type.
289289
| string | minLength | Minimum Length | No | Minimum length of the string. |
290290
| string | pattern | Pattern | No | Regular expression pattern to define valid value. Follows regular expression syntax from ECMA-262 (https://262.ecma-international.org/5.1/#sec-15.10.1). |
291291

292+
#### Expressing Date / Datetime / Timezone information
293+
294+
Given the complexity of handling various date and time formats (e.g., date, datetime, time, timestamp, timestamp with and without timezone), the existing `logicalType` options currently support only `date`. To specify additional temporal details, `logicalType` should be used in conjunction with `logicalTypeOptions.format` to define the desired format.
295+
296+
``` yaml
297+
version: 1.0.0
298+
kind: DataContract
299+
id: 53581432-6c55-4ba2-a65f-72344a91553a
300+
status: active
301+
name: date_example
302+
apiVersion: v3.0.1
303+
schema:
304+
# Date Only
305+
- name: event_date
306+
logicalType: date
307+
logicalTypeOptions:
308+
- format: "YYYY-MM-DD"
309+
examples:
310+
- "2024-07-10"
311+
312+
# Date & Time (UTC)
313+
- name: created_at
314+
logicalType: date
315+
logicalTypeOptions:
316+
- format: "YYYY-MM-DDTHH:MM:SSZ"
317+
examples:
318+
- "2024-03-10T14:22:35Z"
319+
320+
# Time Only
321+
- name: event_start_time
322+
logicalType: date
323+
logicalTypeOptions:
324+
- format: "HH:MM:SS"
325+
examples:
326+
- "08:30:00"
327+
328+
```
329+
292330
### Authoritative definitions
293331

294332
Reference to an external definition on element logic or values.

0 commit comments

Comments
 (0)