Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use _.isDate to check if object is a Date object #335

Conversation

joliveros
Copy link
Contributor

@joliveros joliveros commented Apr 4, 2018

When running the snippet below, in some node versions the code fails because twilio-node is unable to format the given startDate and endDate parameters.

// Download the helper library from https://www.twilio.com/docs/node/install
// Your Account Sid and Auth Token from twilio.com/console
const accountSid = 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.calls.feedbackSummaries
            .create({
               startDate: new Date(Date.UTC(2008, 0, 2)),
               endDate: new Date(Date.UTC(2008, 0, 2))
             })
            .then(feedback_summary => console.log(feedback_summary.sid))
            .done();

I've narrowed down the issue to the following line:
https://github.com/twilio/twilio-node/blob/master/lib/base/serialize.js#L22
This PR attempts to fix this issue.

@dprothero
Copy link

LGTM

Copy link
Contributor

@codejudas codejudas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Thanks for the fix!

@dprothero dprothero merged commit 51e3cab into twilio:master Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants