ScaleLeap / amazon-advertising-api-sdk

Amazon Advertising API TypeScript and Node.js Unofficial SDK
https://npm.im/@scaleleap/amazon-advertising-api-sdk
MIT License
26 stars 21 forks source link

Create new type for Dates from number #7

Closed moltar closed 5 years ago

moltar commented 5 years ago

Amazon API returns dates as epoch in seconds.

Example:

"creationDate": 1526510030,

We need a type that converts this epoch numeric date to a JS Date object.

There is a good example here, but I think it uses milliseconds.

nguyentoanit commented 5 years ago

Could you check again about "Amazon API returns dates as epoch in seconds."

I tried to get portfolio from API. It returned dates as epoch in milliseconds (not seconds)

  "creationDate": 1560826309267,
  "lastUpdatedDate": 1560826309267,
nguyentoanit commented 5 years ago

I found that docs also mentioned about them:

"creationDate": {
           "description": "The date the campaign was created as epoch time in milliseconds",
           "type": "number"
       },
       "lastUpdatedDate": {
           "description": "The date the campaign was last updated as epoch time in milliseconds",
           "type": "number"
       },

https://advertising.amazon.com/API/docs/v2/reference/campaigns#CampaignEx

moltar commented 5 years ago

That is an excellent investigative work. Thanks!