1. If you update to Joomla 3.8.10, please make sure that you either do a full GitHub update of Fabrik, or disable caching for your lists (in the Advanced settings) or turn off Joomla's System Cache setting. A change in Joomla's cache code in 3.8.10 required a fix in Fabrik, which will be rolled in to the next release, but is currently only available in GitHub.

Comparing two dates in javascript

May 27, 2013
Comparing two dates in javascript
  • Edit your end date element.
    Add a new blur event with the following code:

    Code (Javascript):

    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.setMonth(start[1].toInt() - 1);
      var enddate = new Date();
      enddate.setMonth(end[1].toInt() - 1);
      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';