From de6a547272527d27a828c229360b7b66a00ba67f Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 7 Jan 2020 09:35:11 +0100 Subject: [PATCH 1/2] Use today as default date in DATETIME attribute (#2666) --- application/helpers/locale_helper.php | 1 + application/views/attributes/item.php | 2 +- application/views/partial/datepicker_locale.php | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/helpers/locale_helper.php b/application/helpers/locale_helper.php index ab79e68dc..4fc93a842 100644 --- a/application/helpers/locale_helper.php +++ b/application/helpers/locale_helper.php @@ -3,6 +3,7 @@ const DEFAULT_LANGUAGE = 'english'; const DEFAULT_LANGUAGE_CODE = 'en-US'; +define('NOW', mktime()); define('DEFAULT_DATE', mktime(0, 0, 0, 1, 1, 2010)); define('DEFAULT_DATETIME', mktime(0, 0, 0, 1, 1, 2010)); diff --git a/application/views/attributes/item.php b/application/views/attributes/item.php index df0f1a236..581741808 100644 --- a/application/views/attributes/item.php +++ b/application/views/attributes/item.php @@ -24,7 +24,7 @@ foreach($definition_values as $definition_id => $definition_value) if ($definition_value['definition_type'] == DATE) { - $value = (empty($attribute_value) || empty($attribute_value->attribute_date)) ? DEFAULT_DATE : strtotime($attribute_value->attribute_date); + $value = (empty($attribute_value) || empty($attribute_value->attribute_date)) ? NOW : strtotime($attribute_value->attribute_date); echo form_input(array( 'name' => "attribute_links[$definition_id]", 'value' => to_date($value), diff --git a/application/views/partial/datepicker_locale.php b/application/views/partial/datepicker_locale.php index c35c121de..0d9c1dd6a 100644 --- a/application/views/partial/datepicker_locale.php +++ b/application/views/partial/datepicker_locale.php @@ -3,7 +3,6 @@ var pickerconfig = function(config) { return $.extend({ format: "config->item('dateformat')) . ' ' . dateformat_bootstrap($this->config->item('timeformat'));?>", - startDate: "", config->item('timeformat'); $m = $t[strlen($t)-1]; From 615038ef38a301c66b2a0fc9182b266d07634c20 Mon Sep 17 00:00:00 2001 From: jekkos Date: Sat, 11 Jan 2020 20:08:45 +0100 Subject: [PATCH 2/2] Change mktime() with time() (#2666) --- application/helpers/locale_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/helpers/locale_helper.php b/application/helpers/locale_helper.php index 4fc93a842..f3d87f5e8 100644 --- a/application/helpers/locale_helper.php +++ b/application/helpers/locale_helper.php @@ -3,7 +3,7 @@ const DEFAULT_LANGUAGE = 'english'; const DEFAULT_LANGUAGE_CODE = 'en-US'; -define('NOW', mktime()); +define('NOW', time()); define('DEFAULT_DATE', mktime(0, 0, 0, 1, 1, 2010)); define('DEFAULT_DATETIME', mktime(0, 0, 0, 1, 1, 2010));