cozy / cozy-client-js

Javascript library to write Cozy applications
https://docs.cozy.io/en/cozy-client-js/README/
MIT License
11 stars 12 forks source link

feat: Send UpdatedAt & CreatedAt with docs #303

Closed taratatach closed 4 years ago

taratatach commented 4 years ago

We want to allow clients to create and update documents with precise creation and modification dates (up to the milliseconds). However, the current way to send those dates, via the Date header does not give us this precision as it is formatted without milliseconds.

The Cozy stack accepts CreatedAt and UpdatedAt query-string parameters to set those attributes during a file or directory creation and accepts UpdatedAt during updates. Those parameters are expected to follow RFC 3339 (see rfc-editor.org/rfc/rfc3339.txt) which gives us the opportunity to pass fractions of a second thus milliseconds.

For retrocompatibility, we leave the option to pass the lastModifiedDate argument to cozy-client-js functions but clients will be able to pass created_at and updated_at arguments to be passed via the query-string parameters.