AziCode
AziCode

Reputation: 2692

How to customize my timer display to show only minutes and seconds?

My Timer is displaying Minutes and Hours, but once it gets to 60 minutes it restarts from 0 Minute.

Upvotes: 1

Views: 124

Answers (1)

SentientBacon
SentientBacon

Reputation: 1559

% 60 means that it will spit out a minutes value that is the remainder when divided by 60(minutes). This is most probably because for time in the form hh:mm, you want it to go from 5:59 to 6:00, not 5:60. So changing the following line will give you what you seek.

let minutes = (interval / 60) % 60 -> let minutes = interval / 60

Upvotes: 3

Related Questions