• Payment Plugins Poll

    We need your feedback on the need for updated payment plugins. Please go here and give us your feedback.

  • Joomla 5.1

    For running J!5.1 you must install Fabrik 4.1
    See also Announcements

  • Subscription and download (Fabrik 4.1 for J!4.2+ and J!5.1) are working now

    See Announcement
    Please post subscription questions and issues here

    We have resolved the issue with the J! updater and this will be fixed in the next release.

Comparing two dates in javascript

  • Views Views: 18,700
  • Last updated Last updated:
  • Edit your end Date element.
    Add a new blur event with the following code:


    var startid= 'jos_events___start_date_cal';

    var endid = 'jos_events___end_date_cal';

    var start = document.id(startid).get('value').split('-');

    var end = document.id(endid).get('value').split('-');

    if (start.length > 1) {
    var startdate = new Date();
    startdate.setFullYear(start[0]);
    startdate.setMonth(start[1].toInt() - 1);
    startdate.setDate(start[2]);
    var enddate = new Date();
    enddate.setFullYear(end[0]);
    enddate.setMonth(end[1].toInt() - 1);
    enddate.setDate(end[2]);
    if (enddate < startdate) {
    alert('woops your end date is earlier than your start date');
    document.id(endid).value = [I];[/I]
    }

    }

    Edit it so that the first two lines point to the id's of your start and end date fields. This also presumes that your date Elements are recording the dates in the format 'yyyy-mm-dd';
Back
Top