Skip to content

Commit

Permalink
Merge pull request #503 from nextcloud/chore/caldav-trashbin-iso-time…
Browse files Browse the repository at this point in the history
…stamps

Use ISO8601 timestamps for the CalDAV trashbin
  • Loading branch information
ChristophWurst authored Jun 23, 2021
2 parents b7a567e + 82714fc commit 8a8d42f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/dist.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dist.js.map

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default class Parser {
this.registerParser('{http://owncloud.org/ns}enabled', Parser.bool);
this.registerParser('{http://owncloud.org/ns}read-only', Parser.bool);
this.registerParser('{http://nextcloud.com/ns}owner-displayname', Parser.text);
this.registerParser('{http://nextcloud.com/ns}deleted-at', Parser.decInt);
this.registerParser('{http://nextcloud.com/ns}deleted-at', Parser.iso8601DateTime);
this.registerParser('{http://nextcloud.com/ns}calendar-uri', Parser.text);
this.registerParser('{http://nextcloud.com/ns}has-photo', Parser.bool);
this.registerParser('{http://nextcloud.com/ns}trash-bin-retention-duration', Parser.decInt);
Expand Down Expand Up @@ -253,6 +253,20 @@ export default class Parser {
return new Date(text);
}

/**
* returns Date from an ISO8601 string
*
* @param {Document} document
* @param {Node} node
* @param {XPathNSResolver} resolver
* @returns {Date}
*/
static iso8601DateTime(document, node, resolver) {
const text = Parser.text(document, node, resolver);

return new Date(text);
}

/**
* returns Date value of Node
*
Expand Down

0 comments on commit 8a8d42f

Please sign in to comment.