Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to decrease current time minutes 10 interval for each using Typescript?

$
0
0

In Myscenario, I am trying to generate the time list with 10 minutes intervals. I am using below code but not able to achieve exactly. Also, below code it is giving 24 hrs format but I need to achieve this using 12 hrs format.

for(var i=0;i<4;i++){        date.setMinutes(date.getMinutes() + interval);        labels.push(`${date.getHours() +'.'+ date.getMinutes()}${suffix}`);        labels.reverse();      }

Expected Output: [10.30PM, 10.40PM, 10.50PM, 11.00PM] //Current time 11.00PM should be last index.


Viewing all articles
Browse latest Browse all 6287

Trending Articles