• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Comparing two dates in javascript

  • Views Views: 18,195
  • 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