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

Parsing some dates fine, but not others #122

Open
ahmed-h opened this issue Jul 17, 2019 · 3 comments
Open

Parsing some dates fine, but not others #122

ahmed-h opened this issue Jul 17, 2019 · 3 comments

Comments

@ahmed-h
Copy link

ahmed-h commented Jul 17, 2019

I have a Vue JS SPA that queries takes a keyword and returns 10 tweets from Twitter which contain that keyword. These tweets are mixed (some popular + some recent). The dataset that Twitter returns contains the created_at timestamp in the following format:

Wed Jul 17 04:20:30 +0000 2019

In my Vue file's template section, I am displaying a tweet's created_at date using the following code:

{{ [tweet.created_at, "ddd MMM DD HH:mm:ss Z YYYY"] | moment("calendar") }}

The result of this is quite odd. It is displaying some of the tweets correctly, and the others it is printing out the entire date + format string code. Here is a screenshot of the result:

Screen Shot 2019-07-17 at 3 22 06 PM

I just can't for the life of me figure out how it is working in some cases and not in others. All the dates are received in the same format and go through the same parsing format.

Any help would be greatly appreciated.

Thanks!

@BrockReece
Copy link
Collaborator

Hey, can you give an example of a date that was correctly parsed?

@ahmed-h
Copy link
Author

ahmed-h commented Jul 18, 2019

Sure @BrockReece - as you see from the screenshots, the 2nd and the last entries are showing the correct moment('calendar') version of the date, which means that they parsed correctly. They were in the exact same format. For example, this is the created_at value for the 2nd tweet in the list: Wed Jul 17 16:17:59 +0000 2019 - which parsed correctly.

My suspicion is that tweets that are made 'ahead' of my current time (due to timezone differences) are causing a problem.

@ahmed-h
Copy link
Author

ahmed-h commented Jul 29, 2019

Bump, in hopes that this gets looked at.

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

No branches or pull requests

2 participants