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

Add time datatype, and maybe date too #214

Open
bggardner opened this issue Aug 9, 2020 · 5 comments
Open

Add time datatype, and maybe date too #214

bggardner opened this issue Aug 9, 2020 · 5 comments

Comments

@bggardner
Copy link

There are use cases where only the time portion of a datetime property is relevant, such as in a daily schedule. Using the datetime datatype is possible, but would result in an infinite number of values that would represent the same time (with different dates). The reverse could also be said about only needing the date portion, but that can more easily be resolved by setting the time portion to zero. In either case, ISO 8601 formats are established.

On the implementation side, JavaScript does not have a time class (though the HTML input type=time exists), but Python does (datetime.time). In lieu of researching other languages, would this cause heartburn with any other implementations?

@piegamesde
Copy link
Contributor

Instead of adding yet another data type, what about using the $format attribute for this?

@bggardner
Copy link
Author

Possibly, but that may be confusing, since the "format" needs to be according to ISO 8601. Values of $format could be:

  • datetime (default if not defined) - Full datetime
  • date - Just the date
  • time - Just the time

No to open a can of worms, but $format is really a misnomer for all the data types, as it's really just extended data type information. I would expect "format" to be used for displaying information, not describing it. Just another thing to consider.

@bggardner
Copy link
Author

An alternative approach (just brainstorming here) is to make $datatype simply iso8601, and use $format to express one of datetime (default, maybe), date, time, duration, or interval. However, I think the reverse would be more appropriate: having a separate $datatype for each one, and making $format (if defined at all) always be ISO 8601.

@mjcumming
Copy link
Contributor

From the Convention description, it seems that $format is being used to further describe the datatype.

"$format | Specifies restrictions or options for the given data type"

I agree, we should probably add datatypes for date, time and interval. We already have datetime and duration. Correct me if I am wrong, but would the datatime datatype already hand just date or just time?

@joelightshoe
Copy link

An additional consideration is that datetime in ISO-8601 can be formatted as

  • local (no time zone information), such as "2007-12-03T10:15:30"
  • offset from UTC, such as "2007-12-03T10:15:30+01:00", or
  • zoned with a time-zone ID, such as "2007-12-03T10:15:30+01:00 Europe/Paris"

The Java 8 Time API is a good reference.

time is generally either local or offset and not zoned, since date information is required for time-zone to be meaningful, and date is generally only local. Perhaps $format could be leveraged somehow to convey that. For example,

  • datetime [local, offset, zoned]
  • time [local, offset]
  • date [local]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants