Vuejs get time getHours error

the acquisition of vue+elementUI, elementUI time components used by the project is standard time.
I use js to format
such as simple:
var time = new Date ("Thu May 12 2016 08:00:00 GMT+0800");

newDate=time .getFullYear () +"-"+ (time .getMonth () + 1) +"-"+ time .getDate () +"+ time .getHours () +":"+ time .getMinutes () +":"+ time .getSeconds ();

in this way, an error will be reported after running
. What is the reason for this

?

clipboard.png

Mar.13,2021
The

code can be run directly.
did you write this code directly into the html template? You should write a calculation attribute


your error report should not be here. I do not report an error when I copy your code. It should be the error report caused by the value passed by the time component


js. There is no problem with the native method. You can monitor the value of time in the component and print it out to see whether it is an instance of Date


should not be the problem here. Do you see if there is a problem with the component


did the landlord solve it? I also encountered this problem

Menu