Index: date_facets.facetapi.inc
===================================================================
--- date_facets.facetapi.inc	(revision 541)
+++ date_facets.facetapi.inc	(working copy)
@@ -37,5 +37,12 @@
         'adapter' => 'search',
       ),
     ),
+    'search_api_date_range' => array(
+      'handler' => array(
+        'class' => 'Drupal_SearchApi_Facetapi_QueryType_DateRangeQueryType',
+        'adapter' => 'search_api',
+      ),
+    ),
+
   );
 }
Index: date_facets.info
===================================================================
--- date_facets.info	(revision 541)
+++ date_facets.info	(working copy)
@@ -4,6 +4,7 @@
 package = Search Toolkit
 core = 7.x
 files[] = lib/Drupal/Apachesolr/Facetapi/QueryType/DateRangeQueryType.php
+files[] = lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php
 files[] = lib/Drupal/Facetapi/Widget/DateRangeWidget.php
 files[] = lib/Drupal/Search/Facetapi/QueryType/DateRangeQueryType.php
 
Index: date_facets.module
===================================================================
--- date_facets.module	(revision 541)
+++ date_facets.module	(working copy)
@@ -13,6 +13,7 @@
 function date_facets_facetapi_facet_info_alter(array &$facet_info, array $searcher_info) {
   switch ($searcher_info['adapter']) {
     case 'apachesolr':
+    case 'search_api':
     case 'search':
       date_facets_associate_widget($facet_info);
       break;
@@ -28,13 +29,40 @@
 function date_facets_associate_widget(array &$facet_info) {
   foreach ($facet_info as $name => $info) {
     $query_types = array_flip($info['query types']);
-    if (isset($query_types['date'])) {
+    // The check on field_type is specific for search api.
+    // @todo check if there is a beter way to do this.
+    if (isset($query_types['date']) || $info['field type'] == 'list<date>') {
       $facet_info[$name]['query types'][] = 'date_range';
+      
+      //This widget needs a different way to set labels so we add our own callback
+      $facet_info[$name]['map options']['value callback'] = '_date_facets_api_facet_create_label';
     }
   }
 }
 
 /**
+ * Value callback for labels with the date range type
+ * 
+ * Just added a basic functionality. Might need to be expanded for more functionality 
+ * 
+ * @param array $values
+ * @param array $options
+ * @return multitype:unknown
+ */
+function _date_facets_api_facet_create_label(array $values, array $options) {
+	$map = array();
+	
+	//Loop through all the values to create a map. It does nothing yet but more functionality might be added.
+	if($values) {
+		foreach($values as $key => $value) {
+			$map[$key] = $value;		
+		}
+	}
+	
+	return $map;
+}
+
+/**
  * Returns render arrays for all date ranges.
  *
  * @return array
@@ -70,5 +98,7 @@
     '#markup' => t('Past year'),
   );
 
+  drupal_alter('date_facets_get_ranges', $build);
+
   return $build;
 }
Index: lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php
===================================================================
--- lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php	(revision 0)
+++ lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php	(working copy)
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal_SearchApi_Facetapi_QueryType_DateRangeQueryType.
+ */
+
+/**
+ * Date range query type plugin for the Apache Solr Search Integration adapter.
+ */
+class Drupal_SearchApi_Facetapi_QueryType_DateRangeQueryType extends SearchApiFacetapiDate implements FacetapiQueryTypeInterface {
+
+  /**
+   * Implements FacetapiQueryTypeInterface::getType().
+   */
+  static public function getType() {
+    return 'date_range';
+  }
+
+  /**
+   * Implements FacetapiQueryTypeInterface::execute().
+   */
+  public function execute($query) {
+    if ($active = $this->adapter->getActiveItems($this->facet)) {
+      // Check the first value since only one is allowed.
+      $filter = self::mapFacetItemToFilter(key($active));
+      if ($filter) {
+        $this->addFacetFilter($query, $this->facet['field'], $filter);
+      }
+    }
+  }
+
+  /**
+   * Implements FacetapiQueryTypeInterface::build().
+   *
+   * Unlike normal facets, we provide a static list of options.
+   */
+  public function build() {
+    return date_facets_get_ranges();
+  }
+
+  /**
+   * Maps a facet item to a filter.
+   *
+   * @param string $key
+   *   Facet item key, for example 'past_hour'.
+   *
+   * @return string|false
+   *   A string that can be used as a filter, false if no filter was found.
+   */
+  public function mapFacetItemToFilter($key) {
+    $options = self::getFacetItems();
+    return isset($options[$key]) ? $options[$key] : FALSE;
+  }
+
+  /**
+   * Gets a list of facet items and matching filters.
+   *
+   * @return array
+   *   List of facet items and their filters.
+   */
+  public function getFacetItems() {
+    $now = $_SERVER['REQUEST_TIME'];
+    $past_hour = strtotime('-1 hour');
+    $past_24_hours = strtotime('-24 hour');
+    $past_week = strtotime('-1 week');
+    $past_month = strtotime('-1 month');
+    $past_year = strtotime('-1 year');
+
+    $options = array(
+      'past_hour'     => "[$past_hour TO $now]",
+      'past_24_hours' => "[$past_24_hours TO $now]",
+      'past_week'     => "[$past_week TO $now]",
+      'past_month'    => "[$past_month TO $now]",
+      'past_year'     => "[$past_year TO $now]",
+    );
+
+    drupal_alter('date_facets_search_api_facet_items', $options);
+
+    return $options;
+  }
+}
