sailrish / shipit

shipit node module
MIT License
87 stars 65 forks source link

Usps fails with deprecation warning #32

Closed andris310 closed 5 years ago

andris310 commented 8 years ago

Usps module fails with: Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

https://github.com/sailrish/shipit/pull/31

ghost commented 7 years ago

Getting the same error. But everything works

module: "shipit": "^1.0.2",

Error

Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non IS
O date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: February 3, 2017 1:04 pm +0000, _f: undefined, _strict: undefined, _locale: [object Object]

Stack Trace

Error
    at Function.createFromInputFallback (/projectDir/node_modules/moment/moment.js:318:94)
    at configFromString (/projectDir/node_modules/moment/moment.js:2080:15)
    at configFromInput (/projectDir/node_modules/moment/moment.js:2444:9)
    at prepareConfig (/projectDir/node_modules/moment/moment.js:2427:9)
    at createFromConfig (/projectDir/node_modules/moment/moment.js:2394:40)
    at createLocalOrUTC (/projectDir/node_modules/moment/moment.js:2481:12)
    at createLocal (/projectDir/node_modules/moment/moment.js:2485:12)
    at hooks (/projectDir/node_modules/moment/moment.js:16:25)
    at UspsClient.presentTimestamp (/projectDir/node_modules/shipit/lib/usps.js:91:14)
    at UspsClient.presentActivity (/projectDir/node_modules/shipit/lib/usps.js:182:24)
    at UspsClient.getActivitiesAndStatus (/projectDir/node_modules/shipit/lib/usps.js:197:27)
    at /projectDir/node_modules/shipit/lib/shipper.js:91:24
    at handleResponse (/projectDir/node_modules/shipit/lib/usps.js:62:16)
    at Parser.<anonymous> (/projectDir/node_modules/xml2js/lib/xml2js.js:489:18)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)
    at Object.onclosetag (/projectDir/node_modules/xml2js/lib/xml2js.js:447:26)
    at emit (/projectDir/node_modules/sax/lib/sax.js:640:35)
    at emitNode (/projectDir/node_modules/sax/lib/sax.js:645:5)
    at closeTag (/projectDir/node_modules/sax/lib/sax.js:905:7)
    at Object.write (/projectDir/node_modules/sax/lib/sax.js:1449:13)
    at Parser.exports.Parser.Parser.parseString (/projectDir/node_modules/xml2js/lib/xml2js.js:508:31)
    at Parser.parseString (/projectDir/node_modules/xml2js/lib/xml2js.js:7:59)
    at UspsClient.validateResponse (/projectDir/node_modules/shipit/lib/usps.js:65:26)
    at UspsClient.ShipperClient.presentResponse (/projectDir/node_modules/shipit/lib/shipper.js:85:19)
    at Request._callback (/projectDir/node_modules/shipit/lib/shipper.js:134:24)
    at Request.self.callback (/projectDir/node_modules/shipit/node_modules/request/request.js:122:22)
    at emitTwo (events.js:106:13)
sailrish commented 5 years ago

This has been fixed. Example: http://shipit-api.herokuapp.com/api/carriers/usps/9361289707090543509852

{  
   "eta":"2019-01-25T23:59:59.000Z",
   "service":"Parcel Select",
   "destination":"Chicago, IL 60607",
   "activities":[  
      {  
         "timestamp":"2019-01-25T12:18:00.000Z",
         "location":"Chicago, IL 60607",
         "details":"Delivered, In/At Mailbox"
      },
      {  
         "timestamp":"2019-01-25T05:33:00.000Z",
         "location":"Chicago, IL 60699",
         "details":"Arrived at Post Office"
      },
      {  
         "timestamp":"2019-01-24T22:57:00.000Z",
         "location":"Chicago, IL 60607",
         "details":"USPS in possession of item"
      },
      {  
         "timestamp":"2019-01-24T20:08:00.000Z",
         "location":"Lockport, IL 60441",
         "details":"Departed Shipping Partner Facility, USPS Awaiting Item"
      },
      {  
         "timestamp":"2019-01-24T03:19:00.000Z",
         "location":"Monee, IL 60449",
         "details":"Departed Shipping Partner Facility, USPS Awaiting Item"
      },
      {  
         "timestamp":"2019-01-23T23:53:00.000Z",
         "location":"Monee, IL 60449",
         "details":"Picked Up by Shipping Partner, USPS Awaiting Item"
      }
   ],
   "status":4,
   "request":{  
      "trackingNumber":"9361289707090543509852"
   }
}