I had a similar problem.
After researching I found three useful links :
Date variable works, but functions on it do not
Converting string to date issue
Invalid argument 'date format' for pipe 'DatePipe'?
What I then did was to declare my variable as type Date in the "export class" component like this :
start: Date
and then later on in a function I used it like this to populate the date variable:
start = new Date(Date.now());
Judging on the error you are receiving I assume that your function "startOfDay()" is returning a string so you would then have to change your code as follows.
start: new Date(startOfDay(new Date(attendance.dayAt)))
reason for this being that if "start" is a date then you have to use the function new Date() to assign a date to it. Date then takes string as input and returns a date and assigns it to variable "start". Hope this helps :)
startOfDay
function? – Donetsstart: startOfDay(new Date(attendance.dayAt).toString())
to see if it works? – Donetsstart
config, I seestartsAt
– Donetsstart:
orstartOfDay()
(you even don't specify this) expects a string but you assign a Date. So the answer must be eitherstartOfDay(new Date(attendance.dayAt).toString())
orstartOfDay(new Date(attendance.dayAt)).toString()
– Donets