umts / pvta-multiplatform

Transit realtime app for mobile devices
Other
6 stars 5 forks source link

Re-Enable momentjs Suffixes #431

Closed dfaulken closed 6 years ago

dfaulken commented 7 years ago

Looking at the screen which lists multiple upcoming departures of a particular route at a stop, I saw this:

Real time "Scheduled" "Estimated"
8:24 am 8:24 am 8:28 am (4 minutes)
8:28 am 8:24 am (4 minutes) 8:28 am

Since I didn't look at my phone during the intervening 4 minutes, it caught me off guard a little. Perhaps we should distinguish between "in 4 minutes" and "4 minutes ago"?

akaplo commented 7 years ago

Great catch @dfaulken. Easily reproducible.

Solution: http://momentjs.com/docs/#/displaying/fromnow/

If you pass true, you can get the value without the suffix.

moment([2007, 0, 29]).fromNow(); // 4 years ago moment([2007, 0, 29]).fromNow(true); // 4 years

One liner fix for us.