Skip to content

Commit

Permalink
feat(patternsAsOf): Add support for date strings in WithAsOf function…
Browse files Browse the repository at this point in the history
… of patterns context (#63)
  • Loading branch information
k-grant authored Sep 9, 2019
1 parent fbda1c4 commit 0fe1710
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/resources/PatternsContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ class PatternsContext extends PagedContext {
* @returns {PatternsContext} Returns itself
*/
withAsOf(asOf) {
this.params.as_of = asOf.toISOString();
let asOfDate;
if (asOf instanceof Date) {
asOfDate = asOf.toISOString();
} else {
asOfDate = asOf;
}

this.params.as_of = asOfDate;
return this;
}

Expand Down

0 comments on commit 0fe1710

Please sign in to comment.