Date format

Post Reply
bernard.lee
Posts: 70
Joined: 14 Apr 2017, 10:50
Name: Bernard Lee
Location: Singapore

Date format

Post by bernard.lee »

Is it a bug? While having a date format as shown:

Code: Select all

d-M-Y (D)
Screenshot 2019-05-11 at 12.31.41 AM.png
Screenshot 2019-05-11 at 12.31.41 AM.png (11.38 KiB) Viewed 2556 times
It supposed to display in 10-May-2019 (Fri)
but it turned out there is a space appeared between after 10-<space>May-2019 (<space>Fri)

Able to correct the bug or any advice?
Attachments
Screenshot 2019-05-11 at 12.31.27 AM.png
Screenshot 2019-05-11 at 12.31.27 AM.png (9.12 KiB) Viewed 2556 times
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Date format

Post by support »

Found issue. Will be fixed in 2.5

To fix now ope file includes/functions/app.php and find code

Code: Select all

function i18n_date() {
...
}
Replace it to:

Code: Select all

function i18n_date() {

  $days = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
  $daysshort = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
  $daysmin = array("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su");
  $month = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  $monthshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
  
  $translate = array();
  
  $days_i18n = explode(',',str_replace('"','',TEXT_DATEPICKER_DAYS));
  foreach($days as $k=>$v)
  {
   $translate[$v] = trim($days_i18n[$k]);
  }  
  
  $daysshort_i18n = explode(',',str_replace('"','',TEXT_DATEPICKER_DAYSSHORT));
  foreach($daysshort as $k=>$v)
  {
   $translate[$v] = trim($daysshort_i18n[$k]);
  }
  
  $daysmin_i18n = explode(',',str_replace('"','',TEXT_DATEPICKER_DAYSMIN));
  foreach($daysmin as $k=>$v)
  {
   $translate[$v] = trim($daysmin_i18n[$k]);
  } 
  
  $month_i18n = explode(',',str_replace('"','',TEXT_DATEPICKER_MONTHS));
  foreach($month as $k=>$v)
  {
   $translate[$v] = trim($month_i18n[$k]);
  }
  
  $monthshort_i18n = explode(',',str_replace('"','',TEXT_DATEPICKER_MONTHSSHORT));
  foreach($monthshort as $k=>$v)
  {
   $translate[$v] = trim($monthshort_i18n[$k]);
  }      
                           
  if (func_num_args() > 1) {
      $timestamp = func_get_arg(1);
      return strtr(date(func_get_arg(0), $timestamp), $translate);
  } else {
      return strtr(date(func_get_arg(0)), $translate);
  }
}
Let me know if it works ok now.
bernard.lee
Posts: 70
Joined: 14 Apr 2017, 10:50
Name: Bernard Lee
Location: Singapore

Re: Date format

Post by bernard.lee »

Good job! =)
Post Reply