diff --git a/addtocalendar.module b/addtocalendar.module
index d1e420c..88739a4 100644
--- a/addtocalendar.module
+++ b/addtocalendar.module
@@ -26,7 +26,7 @@ function addtocalendar_help($route_name, RouteMatchInterface $route_match) {
  */
 function addtocalendar_field_formatter_third_party_settings_form($plugin, $field_definition, $view_mode, $form, $form_state) {
   $element = [];
-  if (in_array('datetime', $plugin->getPluginDefinition()['field_types'])) {
+  if (count(array_intersect(['datetime', 'daterange'], $plugin->getPluginDefinition()['field_types']))) {
     $settings = $plugin->getThirdPartySettings('addtocalendar');
     $element = _addtocalendar_build_form($settings, $field_definition);
   }
@@ -37,7 +37,7 @@ function addtocalendar_field_formatter_third_party_settings_form($plugin, $field
  * Implements hook_field_formatter_settings_summary_alter().
  */
 function addtocalendar_field_formatter_settings_summary_alter(&$summary, $context) {
-  if (in_array('datetime', $context['formatter']->getPluginDefinition()['field_types'])) {
+  if (count(array_intersect(['datetime', 'daterange'], $context['formatter']->getPluginDefinition()['field_types']))) {
     if ($context['formatter']->getThirdPartySetting('addtocalendar', 'addtocalendar_show')) {
       $summary[] = t('Add to calendar enabled');
     }
@@ -48,7 +48,7 @@ function addtocalendar_field_formatter_settings_summary_alter(&$summary, $contex
  * Implements hook_preprocess_field().
  */
 function addtocalendar_preprocess_field(&$variables) {
-  if ($variables['field_type'] == 'datetime') {
+  if ($variables['field_type'] == 'datetime' || $variables['field_type'] == 'daterange') {
     _addtocalendar_preprocess_field($variables);
   }
 }
diff --git a/includes/addtocalendar.build.inc b/includes/addtocalendar.build.inc
index d3bb96f..5e962c0 100644
--- a/includes/addtocalendar.build.inc
+++ b/includes/addtocalendar.build.inc
@@ -33,8 +33,11 @@ function _addtocalendar_preprocess_field(&$variables) {
       if (empty($values[$delta]['value'])) {
         return;
       }
-
       $date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$delta]['value']), 'UTC');
+      if (!empty($values[$delta]['end_value']) && isset($values[$delta]['end_value'])) {
+        $end_date = new DrupalDateTime(preg_replace('/T/', ' ', $values[$delta]['end_value']), 'UTC');
+      }
+
       $build['addtocalendar']['atc_date_start'] = [
         '#type' => 'html_tag',
         '#tag' => 'var',
@@ -64,7 +67,12 @@ function _addtocalendar_preprocess_field(&$variables) {
 
           default:
             $field = $settings['addtocalendar_settings'][$value]['field'];
-            $class_value = strip_tags($entity->{$field}->value);
+            if (strip_tags($entity->{$field}->getFieldDefinition()->getType()) == 'daterange') {
+              $class_value = strip_tags($entity->{$field}->end_value);
+            }
+            else {
+              $class_value = strip_tags($entity->{$field}->value);
+            }
             break;
         }
         $build['addtocalendar'][$value] = [
@@ -77,8 +85,17 @@ function _addtocalendar_preprocess_field(&$variables) {
         ];
       }
 
-      // Assign end date the value of start date if no date is present.
-      $build['addtocalendar']['atc_date_end']['#value'] = (!empty($build['addtocalendar']['atc_date_end']['#value'])) ? $build['addtocalendar']['atc_date_end']['#value'] : $build['addtocalendar']['atc_date_start']['#value'];
+      // Assign end date the value of start date if no end date is present and its not a daterange field.
+      if (empty($end_date)) {
+        $build['addtocalendar']['atc_date_end']['#value'] = (!empty($build['addtocalendar']['atc_date_end']['#value'])) ? $build['addtocalendar']['atc_date_end']['#value'] : $build['addtocalendar']['atc_date_start']['#value'];
+        $build['addtocalendar']['atc_date_end']['#value'] = (!empty($build['addtocalendar']['atc_date_end']['#value'])) ? $build['addtocalendar']['atc_date_start']['#value'] : $date->format('Y-m-d H:i:s', ['timezone' => $timeZone]);
+      }
+      // Assign end date the value of end date if no end date is present and its a daterange field.
+      else {
+        $end_date_val = $end_date->__toString();
+        $build['addtocalendar']['atc_date_end']['#value'] = (!empty($build['addtocalendar']['atc_date_end']['#value'])) ? $build['addtocalendar']['atc_date_end']['#value'] : $end_date_val;
+        $build['addtocalendar']['atc_date_end']['#value'] = $end_date->format('Y-m-d H:i:s', ['timezone' => $timeZone]);
+      }
 
       $build['addtocalendar']['atc_timezone'] = [
         '#type' => 'html_tag',
@@ -140,10 +157,11 @@ function _addtocalendar_preprocess_field(&$variables) {
         $variables['#attached']['library'][] = $style['library'];
       }
     }
+
     if (isset($variables['items'][0]['content']['#markup'])) {
       $variables['items'][0]['content']['#markup'] .= render($build['addtocalendar']);
     }
-    elseif (isset($variables['items'][0]['content']['#theme'])) {
+    elseif (isset($variables['items'][0]['content'])) {
       unset($variables['items'][0]['content']['#theme']);
       $variables['items'][0]['content']['#markup'] = $variables['items'][0]['content']['#text'] . render($build['addtocalendar']);
     }
diff --git a/includes/addtocalendar.form.inc b/includes/addtocalendar.form.inc
index 36d4a8d..0da1d9b 100644
--- a/includes/addtocalendar.form.inc
+++ b/includes/addtocalendar.form.inc
@@ -85,7 +85,6 @@ function _addtocalendar_build_form($settings, $field_definition) {
 
   $fields = Drupal::service('entity_field.manager')->getFieldDefinitions($field_definition->get('entity_type'), $field_definition->get('bundle'));
   $field_options = [];
-
   foreach ($fields as $id => $field) {
     if (is_a($field, 'Drupal\field\Entity\FieldConfig')) {
       $field_options[$id] = $field->getLabel();
@@ -162,7 +161,7 @@ function _addtocalendar_build_form($settings, $field_definition) {
       '#title' => t('Multiple Value Options'),
       '#options' => [
         1 => t('Show one of the values'),
-        // 2 => t('Show multiple AddtoCalendar Buttons'),
+        // 2 => t('Show multiple AddtoCalendar Buttons'),.
       ],
       '#default_value' => !empty($settings['addtocalendar_settings']['multiple_value']) ? $settings['addtocalendar_settings']['multiple_value'] : 1,
     ];
