Ex.:
const options = {
timeZone:"America/Sao_Paulo",
hour12 : false,
hour: "2-digit",
//minute: "2-digit",
//second: "2-digit"
};
console.log(new Date("2019-06-05T00:01:00").toLocaleTimeString("pt-BR",options));
It shows 00 and that's fine. But if i try this only with minute or second, it shows with only one digit.
const options = {
timeZone:"America/Sao_Paulo",
hour12 : false,
//hour: "2-digit",
minute: "2-digit",
//second: "2-digit"
};
console.log(new Date("2019-06-05T00:01:00").toLocaleTimeString("pt-BR",options));
const options2 = {
timeZone:"America/Sao_Paulo",
hour12 : false,
//hour: "2-digit",
//minute: "2-digit",
second: "2-digit"
};
console.log(new Date("2019-06-05T00:01:00").toLocaleTimeString("pt-BR",options2));
What is needed to get minutes or seconds with 2 digits?