Using config-template-card, I want to get the “day” valur from Date()
I can get like this:
${ new Date().toDateString() }
But, that would get the complete DATE:
How to get only the “day” as string (text)? in this case would be “2”.
Using config-template-card, I want to get the “day” valur from Date()
I can get like this:
${ new Date().toDateString() }
But, that would get the complete DATE:
How to get only the “day” as string (text)? in this case would be “2”.
SOLVED:
type: custom:config-template-card
entities:
- sensor.time
card:
type: custom:apexcharts-card
header:
show: true
title: |-
${ var nDay = new Date().getDate();
if (nDay < 7) {
nDay = 7
};
var nDayStr = String(nDay);
nDayStr
}