I vote for "datetime" or "dateTime" over "date-time".
Now that we've established that following EcmaScript is not always
necessary or optimal (which I agree with), there's one other "problem"
with dates. Having a single recommended date format is A Good
Thing(TM). Being unable to describe other date formats is not!
There are cases where one needs to transport a date (or datetime) in a
JSON structure, but doesn't care enough about the format of said date
to want to convert the format back and forth. Oracle is an example of
a database that produces datetime strings that are different from the
format recommended here (do note that ISO8601 specifies a handful of
"recommended formats" of which you seem to have chosen just one,
Oracle another). When making a Schema describing a structure including
such a date, it is still - for documentation - extremely important to
be able to accurately describe the format. The current proposal
doesn't allow for that in anything other that prose.
Would it be impossible to include a "mask" attribute, in which one
could supply a date/time mask, using predefined characters from some
set? The only other possibility is using a regular expression, and
that's neither fulfilling nor readable.
Were it up to me, I would include "datetime" as a "type", not as a
"format", because that's what it is in 90% of the programming
languages slash databases for which JSON makes sense. A "mask"
attribute would then only be applicable for "datetime" types. That
makes more sense than only making it applicable for strings with a
"datetime" format.
/Jakob
PS: In some cases one would also want to format a date/time on the
server as it should be displayed on the client - again, non-
recommended, but important to be able to do it, and describe it in an
easy-to-read manner.
On Jan 9, 3:03 am, "Kris Zyp" <
kris...@gmail.com> wrote:
> Ok, you win :) I changed the proposal. I used "date-time". Is there another
> capitilization format that you would prefer like "dateTime"? Also, I did
> include wording to indicate that "date-time" is the preferred date/time
> format. Also, do you think I should add the other XML Schema date types
> gYearMonth, gYear, gMonthDay, gDay, gMonth as formats?
> Kris
>
> ----- Original Message -----
> From: "SMM" <
jso...@gmail.com>
> To: "JSON Schema" <
json-...@googlegroups.com>
> Sent: Tuesday, January 08, 2008 5:43 PM
> Subject: Re: Discussion on common-json-schema-definitions
>
> Not to beat a dead horse but a quick Google search seems to show that
> Java and JavaScript are the exception rather than the rule for use of
> "Date" rather than "DateTime":
>
> XML Schemahttp://
www.w3.org/TR/xmlschema-2/#isoformats
>
> Microformatshttp://
microformats.org/wiki/datetime-design-pattern
>
> C#
http://msdn2.microsoft.com/en-us/library/system.datetime.aspx
>
> Rubyhttp://
ruby-doc.org/core/classes/DateTime.html
>
> T-SQLhttp://
technet.microsoft.com/en-us/library/ms187819.aspx
>
> MySQLhttp://
dev.mysql.com/doc/refman/6.0/en/datetime.html
>
> PHPhttp://
www.php.net/datetime
>
> Perlhttp://
datetime.perl.org/?Modules
>
> Pythonhttp://
docs.python.org/lib/datetime-datetime.html