1

I have an "event" that I am trying to represent in an API response. What is the best-practice (most rfc3339 compliant?) way to handle dates and times?

The options are an all-day event (single day), multiple day event (may or may not have start and end times), event with no start time, event on a single day with just a start time, event on a single day with start and end time.

My starting point is something like this:

start_date: null or date string (normalized to utc? what format?)
start_time: null or time string (normalized to utc? what format?)
end_date: null or date string (normalized to utc? what format?)
end_time: null or time string (normalized to utc? what format?)
tz: null or timezone string (what format?)

I am wondering whether I should consider having datetime field as well (or in lieu of). Also what other standards/considerations there are.

Also, this also is being implemented in GraphQL (not sure it matters, but if it does, something to consider).

  • [Wikipedia article: ISO 8601](https://en.wikipedia.org/wiki/ISO_8601). BTW, what would null signify for each of the fields? Could you have an event with a start time but no start date? With no start date or time altogether? – Ole V.V. Sep 08 '19 at 10:30

0 Answers0