diff --git a/date_facets.facetapi.inc b/date_facets.facetapi.inc
index db4dfe9..6bf5862 100644
--- a/date_facets.facetapi.inc
+++ b/date_facets.facetapi.inc
@@ -37,5 +37,11 @@ function date_facets_facetapi_query_types() {
         'adapter' => 'search',
       ),
     ),
+    'search_api_date_range' => array(
+      'handler' => array(
+        'class' => 'Drupal_SearchApi_Facetapi_QueryType_DateRangeQueryType',
+        'adapter' => 'search_api',
+      ),
+    )
   );
 }
diff --git a/date_facets.info b/date_facets.info
index 436c477..8a40ed2 100644
--- a/date_facets.info
+++ b/date_facets.info
@@ -6,6 +6,7 @@ core = 7.x
 files[] = lib/Drupal/Apachesolr/Facetapi/QueryType/DateRangeQueryType.php
 files[] = lib/Drupal/Facetapi/Widget/DateRangeWidget.php
 files[] = lib/Drupal/Search/Facetapi/QueryType/DateRangeQueryType.php
+files[] = lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php
 
 ; Information added by drupal.org packaging script on 2012-11-09
 version = "7.x-1.0-beta1"
diff --git a/date_facets.module b/date_facets.module
index 4d7e4c2..16a53c4 100644
--- a/date_facets.module
+++ b/date_facets.module
@@ -14,6 +14,7 @@ function date_facets_facetapi_facet_info_alter(array &$facet_info, array $search
   switch ($searcher_info['adapter']) {
     case 'apachesolr':
     case 'search':
+    case 'search_api':
       date_facets_associate_widget($facet_info);
       break;
   }
@@ -28,19 +29,44 @@ function date_facets_facetapi_facet_info_alter(array &$facet_info, array $search
 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 array
+ */
+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.
+  foreach ($values as $key => $value) {
+    $map[$key] = $value;
+  }
+
+  return $map;
+}
+
+/**
  * Returns render arrays for all date ranges.
  *
  * @return array
  *   An associative array of date ranges.
- *
- * @todo Implement an alter hook?
  */
 function date_facets_get_ranges() {
   $build = array();
@@ -48,27 +74,34 @@ function date_facets_get_ranges() {
   $build['past_hour'] = array(
     '#count' => NULL,
     '#markup' => t('Past hour'),
+    '#time_interval' => 3600,
   );
 
   $build['past_24_hours'] = array(
     '#count' => NULL,
     '#markup' => t('Past 24 hours'),
+    '#time_interval' => 86400,
   );
 
   $build['past_week'] = array(
     '#count' => NULL,
     '#markup' => t('Past week'),
+    '#time_interval' => 604800,
   );
 
   $build['past_month'] = array(
     '#count' => NULL,
     '#markup' => t('Past month'),
+    '#time_interval' => strtotime('-1 month'),
   );
 
   $build['past_year'] = array(
     '#count' => NULL,
     '#markup' => t('Past year'),
+    '#time_interval' => strtotime('-1 year'),
   );
 
+  drupal_alter('date_facets_get_ranges', $build);
+
   return $build;
 }
diff --git a/lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php b/lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php
new file mode 100644
index 0000000..c4c0703
--- /dev/null
+++ b/lib/Drupal/SearchApi/Facetapi/QueryType/DateRangeQueryType.php
@@ -0,0 +1,143 @@
+<?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) {
+    $this->adapter->addFacet($this->facet, $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() {
+    $facet = $this->adapter->getFacet($this->facet);
+    $search_ids = drupal_static('search_api_facetapi_active_facets', array());
+
+    if (empty($search_ids[$facet['name']]) || !search_api_current_search($search_ids[$facet['name']])) {
+      return array();
+    }
+    $search_id = $search_ids[$facet['name']];
+
+    $build = array();
+    $search = search_api_current_search($search_id);
+
+    $results = $search[1];
+    if (!$results['result count']) {
+      return array();
+    }
+
+    // Executes query, iterates over results.
+    if (isset($results['search_api_facets']) && isset($results['search_api_facets'][$this->facet['field']])) {
+      $values = $results['search_api_facets'][$this->facet['field']];
+      $build = date_facets_get_ranges();
+      $now = $_SERVER['REQUEST_TIME'];
+      // Calculate values by facet.
+      foreach ($values as $value) {
+        $value['filter'] = str_replace('"', '', $value['filter']);
+        $diff = $now - $value['filter'];
+
+        foreach ($build as $key => $item) {
+          if ($diff < $item['#time_interval']) {
+            $build[$key]['#count'] += 1;
+          }
+        }
+      }
+    }
+
+    // Unset empty items.
+    foreach ($build as $key => $item) {
+      if ($item['#count'] === NULL) {
+        unset($build[$key]);
+      }
+    }
+
+    // Gets total number of documents matched in search.
+    $total = $results['result count'];
+    $keys_of_active_facets = array();
+    // Gets active facets, starts building hierarchy.
+    foreach ($this->adapter->getActiveItems($this->facet) as $key => $item) {
+      // If the item is active, the count is the result set count.
+      $build[$key] = array('#count' => $total);
+      $keys_of_active_facets[] = $key;
+    }
+
+    // If we have active item, unset other items.
+    if (!empty($keys_of_active_facets)) {
+      foreach ($build as $key => $item) {
+        if (!in_array($key, $keys_of_active_facets)) {
+          unset($build[$key]);
+        }
+      }
+    }
+
+    return $build;
+  }
+
+  /**
+   * 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;
+  }
+}
