-1

I'm using FullCalendar with jQuery timepicker to set the event.

I have 2 variables named timeDateInizio and timeDateFine.

Those two variables are string created by merging 2 other variables each, one for the YY:MM:dd and the other for hh:mm:ss

Then I have an if to check if timeDateInizio is after timeDateFine, and if it is a bootbox appear to signal an error. Here is the if: if (timeDateInizio.isAfter(timeDateFine)) {...}.

I receive these error when I get to the if: "Uncaught TypeError: timeDateInizio.isAfter is not a function."

Can someone help me solve this?

  • 1
    It likely that `timeDateInizio` is not a moment object, but you should provide a [mcve] to let everyone set up a proper answer. – VincenzoC May 06 '22 at 10:58

1 Answers1

0

Does casting your variables into Moment objects solve your issue?

if (moment(timeDateInizio).isAfter(moment(timeDateFine))) {...}.
Mike Irving
  • 1,480
  • 1
  • 12
  • 20