Re: Why not ISO 8601 format for date values rendered into JSON?
От | Andrew Dunstan |
---|---|
Тема | Re: Why not ISO 8601 format for date values rendered into JSON? |
Дата | |
Msg-id | 53F15BC9.2010307@dunslane.net обсуждение исходный текст |
Ответ на | Why not ISO 8601 format for date values rendered into JSON? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Why not ISO 8601 format for date values rendered into JSON?
|
Список | pgsql-hackers |
On 08/17/2014 08:42 PM, Tom Lane wrote: > I was just going over the release notes, and noticed the bit about > timestamp and timestamptz now being rendered in a fixed ISO-8601-compliant > format rather than whatever random DateStyle is in use. That's fine, > but I wonder why the same approach wasn't applied to type date? > > regression=# set datestyle to postgres; > SET > > regression=# select row_to_json(row(now())); > row_to_json > ------------------------------------------- > {"f1":"2014-08-17T20:34:54.424237-04:00"} > (1 row) > > regression=# select row_to_json(row(current_date)); > row_to_json > --------------------- > {"f1":"08-17-2014"} > (1 row) > > Doesn't seem real consistent ... > > Good point. Probably because I didn't get a complaint about it, which in turn is probably because JavaScript's builtin Date class is in fact (from our POV) more or less a timestamp(tz) type. See <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date> But yes, I agree it should be fixed. Whatever we output should be suitable as input for the string-argument constructor of class Date. cheers andrew
В списке pgsql-hackers по дате отправления: