jclarke0000 / MMM-MyCommute

This a module for the MagicMirror. It shows your commute time using Google's Traffic API
67 stars 26 forks source link

Not loading (solved) #18

Open elyktc opened 6 years ago

elyktc commented 6 years ago

Spent several hours figuring out why it would only show "Loading..."

Narrowed it down to this line: https://github.com/jclarke0000/MMM-MyCommute/blob/master/MMM-MyCommute.js#L289

Turns out moment.duration(...).format is not a function. Not sure how/if this ever worked.

What you can do instead that is similar is use .humanize() https://momentjs.com/docs/#/durations/humanize/

For example, replace the above line with the following: timeEl.innerHTML = moment.duration(Number(timeInTraffic), "seconds").humanize();

Posting as an issue instead of a pull request since the owner seems to have abandoned this repo, and also because your solution may vary based on your preference.

Hope this saves someone else some time.

dannytsang commented 5 years ago

Worked perfectly for me. Thank you

sheldonjohnson1 commented 4 years ago

I know that this is a dead thread. but you fixed my issue too. what a life saver