Closed achimr closed 9 years ago
The server also does not verify the creationDatetime
value. It should complain about not being in the UTC time zone (the server won't have the knowledge in which time zone the client is).
This is complicated and there is no easy function to verify this. We should expect the time zone is created correctly. Normally time and date is created with a server / client function (as in JavaScript or PHP) which automatically create the correct date.
To clarify: the server should not accept ISO-8601 date/times that are not in UTC format. The Javascript engine V8 included in node.js supports ECMAscript 5. With this the Date.parse function can parse ISO-8601. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse You only need to check that the incoming date string ends with a "Z" before parsing. For conversion from a Date object ECMAscript 5 supports Date.toISOstring() https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
The implementation ignores any incoming dates anyway, as these are attributes which are always generated by the server and cannot be set from external. So I see no need for this check.
Per specification creationDatetime is an allowed optional attribute. The examples in the spec list it too.
I will add the check in one of the next version. I have to add that the basic idea of the date attributes is that they are always automatically created by the rest server, never entered by the user. And the assumption is that the rest server created correct dates. This is also the reason why the server ignores any dates in a POST or PUT request as they are always geenrated automatically - at least by this test server.
Unfortunately there is one more issue in the latest version (2.0i): creationDatetime is now returned in a creationDatetime: "Mon, 10 Nov 2014 19:28:43 GMT" Expected: ISO-8601 format creationDatetime: "2014-11-10T19:28:43Z"
toISOString() now used for DateString. Version 2.0j
Steps to reproduce:
Issues: The attribute
creationDatetime
specified in the request is ignored. Instead the current date/time is used.Expected: Specified
creationDatetime
to be put in data set