umts / pvta-multiplatform

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

Drop seconds for EDT #446

Closed mboneil10 closed 6 years ago

mboneil10 commented 6 years ago

Closes #438

mboneil10 commented 6 years ago

Before

screen shot 2017-11-13 at 3 58 17 pm

After

screen shot 2017-11-13 at 3 57 58 pm
mboneil10 commented 6 years ago

Did I do this correctly? Or should the EDT change to 4:01 PM in the above case?

dfaulken commented 6 years ago

Did I do this correctly? Or should the EDT change to 4:01 PM in the above case?

We should drop seconds from both the current time and the EDT/SDT ~when~ before calculating an interval. Does this do that?

mboneil10 commented 6 years ago

No, it only drops seconds for EDT. I'll do it for SDT too.

dfaulken commented 6 years ago

Question: if the current time is 2:00:59 PM, and we trim the EDT to 2:06:00 PM, how does moment's fromNow display that? 6 minutes? or 5 minutes?

mboneil10 commented 6 years ago

@dfaulken I don't know and I'm unsure of how to check.

dfaulken commented 6 years ago

I think the best way is to insert a debugger into the relevant code and construct some of your own moment objects.

mboneil10 commented 6 years ago

To answer your question from three months ago, @dfaulken... the situation you described displays five minutes.

I did some bs in the code:

     const a = moment('2016-01-01 14:00:59');
     const b = moment('2016-01-01 14:06:00');
     console.log(a.from(b));

Produced: console.log: 5 minutes ago

Assuming that from(now) is equivalent to fromNow, anyway.

mboneil10 commented 6 years ago

All that for two lines of code to change.

dfaulken commented 6 years ago

A very important two lines 😛