Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change date on banners #3

Open
xuanbinh92 opened this issue May 26, 2016 · 6 comments
Open

Unable to change date on banners #3

xuanbinh92 opened this issue May 26, 2016 · 6 comments

Comments

@xuanbinh92
Copy link

https://magestore.zendesk.com/agent/tickets/10633

@Ruby10291
Copy link

ko tái hiện được

@krishana
Copy link

krishana commented Jul 1, 2016

Individual banner Invalid date format selection for start date and end date in admin

For solve this issue need some changes in class Magestore_Bannerslider_Block_Adminhtml_Banner_Edit_Tab_Form

Add function

private function escDates() {
return 'yyyy-MM-dd HH:mm:ss';
}
and changes in fields

      $fieldset->addField('start_time', 'date', array(
          'label'     => Mage::helper('bannerslider')->__('Start time'),
          'name'      => 'start_time',
          'input_format'  => Varien_Date::DATETIME_INTERNAL_FORMAT,
          'image' => $image_calendar,
          'format'    => $this->escDates(),
          'time' => true,
          'required'  => true,
      ));
      $fieldset->addField('end_time', 'date', array(
          'label'     => Mage::helper('bannerslider')->__('End time'),
          'name'      => 'end_time',
          'input_format'  => Varien_Date::DATETIME_INTERNAL_FORMAT,
          'image' => $image_calendar,
          'format'    => $this->escDates(),
          'time' => true,
          'required'  => true,
          'note'=>$note,
      ));

add $this->escDates() instead of "Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)"

@JerichoDiamond
Copy link

JerichoDiamond commented Jul 14, 2016

This isn't a very solid fix. If magento is set to a non-US time-zone, then the bannerslider controller should switch to a valid dmy separator, i.e. dash or period.
Magestore\Bannerslider\controllers\Adminhtml\Bannerslider\BannerController.php
Line 130 after opening try { add this block of code

             $tz = Mage::getStoreConfig('general/locale/timezone');
             if(!preg_match('/^america/i',$tz)) {
                 $data['start_time']=str_replace('/','.',$data['start_time']);
                 $data['end_time']=str_replace('/','.',$data['end_time']);
             }

@ghost
Copy link

ghost commented Mar 9, 2017

Bump. I'm also experiencing the same issue. The JS date picker outputs in UK format DD/MM/YYYY and saving causes the date to be set to unix epoch (1st January 1970). I'm getting around this by manually typing in a US date (MM/DD/YYYY).

@hkvega01
Copy link

hkvega01 commented Apr 6, 2017

krishana's solution work for me, thanks

@vickdoan
Copy link

vickdoan commented May 19, 2017

Lỗi xảy ra khi định dạng format kiểu dd/mm/yyyy

go to this file /app/code/community/Magestore/Bannerslider/controllers/Adminhtml/Bannerslider/BannerController.php - saveAction() funtion

add this codes:
$data['start_time'] = str_replace('/', '-', $data['start_time']);
$data['end_time'] = str_replace('/', '-', $data['end_time']);

before:

try {
$data['start_time']=date('Y-m-d H:i:s',Mage::getModel('core/date')->gmtTimestamp(strtotime($data['start_time'])));
$data['end_time']=date('Y-m-d H:i:s',Mage::getModel('core/date')->gmtTimestamp(strtotime($data['end_time'])));
} catch (Exception $e) {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants