diff --git a/src/Form/SchedulerAdminForm.php b/src/Form/SchedulerAdminForm.php
index ce93c31..dac9f7f 100644
--- a/src/Form/SchedulerAdminForm.php
+++ b/src/Form/SchedulerAdminForm.php
@@ -131,22 +131,19 @@ class SchedulerAdminForm extends ConfigFormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    $config = $this->config('scheduler.settings');
-
-    foreach (Element::children($form) as $variable) {
-      $config->set($variable, $form_state->getValue($form[$variable]['#parents']));
-    }
-    $config->save();
-
     // Extract the date part and time part of the full format, for use with the
     // default time functionality. Assume the date and time time parts begin and
     // end with a letter, but any punctuation between these will be retained.
     $format = $form_state->getValue(['date_format']);
     $time_only_format = $this->getTimeOnlyFormat($format);
-    variable_set('time_only_format', $time_only_format);
-
     $date_only_format = $this->getDateOnlyFormat($format);
-    variable_set('date_only_format', $date_only_format);
+
+    $this->config('scheduler.settings')
+      ->set('time_only_format', $time_only_format)
+      ->set('date_only_format', $date_only_format)
+      ->set('date_foramt', $format)
+      ->set('allow_date_only', $form_state->getValue(['allow_date_only']))
+      ->save();
 
     if (empty($time_only_format)) {
       drupal_set_message(t('The date part of the Scheduler format is %date_part. There is no time part', ['%date_part' => $date_only_format]));
