Skip to content

Commit

Permalink
Merge pull request #5 from bosim/fix-date-serialization
Browse files Browse the repository at this point in the history
fix date serialization for restful calls
  • Loading branch information
druppy authored Jul 2, 2019
2 parents b143321 + 109bb25 commit cf5b8b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/restful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export function mk_query(params: Object) : string {
qs += '&'

if( value != null ) {
if( typeof value != 'string' )
if( value instanceof Date)
value = value.toISOString()
else if( typeof value != 'string' )
value = JSON.stringify( value )

qs += `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
Expand Down

0 comments on commit cf5b8b2

Please sign in to comment.