How can i write this correctly ?
I want to check how many days have passed from publish_end day since the publish_start day and when they are more than 30 days then a message will be display.
var a = new Date("<?php echo $this->item->publish_start; ?>");
var b = a.getDate();
var c = new Date("<?php echo $this->item->publish_end; ?>");
var d = c.getDate();
var e = d - b ;
if( e > 30) {
alert("<?php echo JText::_('You cant put more than 30 days'); ?>");
return false;
}
Use the getTime() function to get the millisecond difference:
(30 days have 2 592 000 000 ms)