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

date parser bug with moment 2.19.3 #318

Closed
dnalborczyk opened this issue Feb 6, 2018 · 1 comment
Closed

date parser bug with moment 2.19.3 #318

dnalborczyk opened this issue Feb 6, 2018 · 1 comment
Labels
type: bug bug in the library

Comments

@dnalborczyk
Copy link

dnalborczyk commented Feb 6, 2018

twilio: v3.11.2
nodejs: v9.5.0

twilio, or rather moment (v2.19.3), is parsing certain RFC2822 dates wrong, and leaves some dates as strings, instead of a Date object.

affected code path:

return parseDate(s, 'ddd, DD MMM YYYY HH:mm:ss [+0000]');

function parseDate(s, format) {

I haven't debugged which version of moment fixed the issue, but 2.20.1 seems to work.
Not sure if this is a bug in moment, or if the formatting string is wrong ('ddd, DD MMM YYYY HH:mm:ss [+0000]')

example repro:

const { startDate } = await client.calls(sid);

if startDate (and any other date for that matter) is e.g. 'Wed, 09 Aug 2017 01:13:35 +0000' as fetched with the REST API, parseDate() m.isValid() will be false, and a string will be returned, as supposed to a date object.

that makes me thinking, why is a string being returned in the first place? was that meant to be some sort of an escape hatch? and why is the API not returning an ISO date which would make matters simpler to begin with?

@dnalborczyk dnalborczyk changed the title moment needs an upgrade date parser bug with moment 2.19.2 Feb 6, 2018
@dnalborczyk dnalborczyk changed the title date parser bug with moment 2.19.2 date parser bug with moment 2.19.3 Feb 7, 2018
@childish-sambino
Copy link
Contributor

Fixed by moment/moment#4227

@childish-sambino childish-sambino added the type: bug bug in the library label Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants