I have a fullcalendar in which i'm using a jquery timepicker. On event click i need to take the start properties (example: "Wed May 04 2022 11:30:00 GMT 0200 (Ora legale dell’Europa centrale)") but using the substring to only have HH:MM. I tried doing: "var x= info.event.end.substring(16, 21);" but when i click an event this error occure: "Uncaught TypeError: info.event.end.substring is not a function" How can i fix this?
CodePudding user response:
end
is a Date
object, and substring
only works on String
objects. Add .toString()
and you'll be able to progress.
var x= info.event.end.toString().substring(16, 21);