Forum

Date Time Locales
 
Notifications
Retirer tout

Date Time Locales

4 Posts
2 Utilisateurs
0 Reactions
5,014 Vu
 dc
(@_dc_)
Posts: 1
New Member
Début du sujet
 
[#196]

Hi,

First of all, this is looking to be a great project management tool, keep up the great work.

The issue I'm having is that while I'm using a "en" locale, the dates are "en_US"(mm/dd/yyyy) and I can't seem to find and easy way to set them to "en_AU"(dd/mm/yyyy).

Have I just missed something, or is this not implemented?

It seem dojo supports "en-au" as stated in the date module.

Maybe if you point me where you tell dojo or how you set you dates displays, and I could write a patch for us Aussies.

Cheers Mate... 🙂


 
Posté : 9 Sep AM 05:099
(@babynus)
Posts: 14952
Membre Admin
 

Hi,
just set you browser locale to en-au.
Dojo will display dates as expected in input fields.
Other "displayed" values will only be displayed as default en, as en-us.
I will look for an improvement on that side.
If you wish, you may change htmlFormatDate($val) in html.php to fit your needs.

Regards.


 
Posté : 9 Sep PM 17:099
(@babynus)
Posts: 14952
Membre Admin
 

Hi,
Final fixing ok for V1.8.0.

If you want to try the fixing before V1.8.0 is deployed :

in /view/js/projector.js, replace function saveBrowserLocaleToSession() with

function saveBrowserLocaleToSession() {
  browserLocale=dojo.locale;
  dojo.xhrPost({
    url: "../tool/saveDataToSession.php?id=browserLocale&value=" + browserLocale,
    load: function(data,args) { }
  });
  var date = new Date(2000, 11, 31, 0, 0, 0, 0);
  var formatted=dojo.date.locale.format(date);
  var format="YYYYMMDD";
  if (formatted.substr(0,2)=='31') {
    format='DDMMYYYY';  
  } else if (formatted.substr(0,2)=='12') {
	format='MMDDYYYY';
  }
  dojo.xhrPost({
    url: "../tool/saveDataToSession.php?id=browserLocaleDateFormat&value=" + format,
    load: function(data,args) { }
  });
}

replace function setupLocale() in /tool/projector.php with

function setupLocale () {
  global $currentLocale, $paramDefaultLocale, $browserLocale, $browserLocaleDateFormat;
  if (isset($_SESSION['currentLocale'])) {
    // First fetch in Session (filled in at login depending on user parameter)
    $currentLocale=$_SESSION['currentLocale'];
  } else if (isset($_REQUEST['currentLocale'])) {
    // Second fetch from request (for screens before user id identified)
    $currentLocale=$_REQUEST['currentLocale'];
    $_SESSION['currentLocale']=$currentLocale;
    $i18nMessages=null; // Should be null at this moment, just to be sure
  } else {
    // none of the above methods worked : get the default one form parameter file
    $currentLocale=$paramDefaultLocale;
  }
  if (isset($_SESSION['browserLocale'])) {
    $browserLocale=$_SESSION['browserLocale'];
  } else {
    $browserLocale=$currentLocale;
  }
  $_SESSION['lang']=$currentLocale; // Must be kept for user parameter screen initialization
  if (isset($_SESSION['browserLocaleDateFormat'])) {
    $browserLocaleDateFormat=$_SESSION['browserLocaleDateFormat'];
  } else {
    $browserLocale='YYYYMMDD';
  }
}

and replace function htmlFormatDate($val) in /tool/html.php

function htmlFormatDate($val) {
  global $browserLocaleDateFormat;
  if (strlen($val)!=10) {
    return $val;
  }
  if ($browserLocaleDateFormat=='MMDDYYYY') {
    return substr($val,5,2) . "/" . substr($val,8,2)  . "/" . substr($val,0,4);
  } else if ($browserLocaleDateFormat=='DDMMYYYY') {
    return substr($val,8,2) . "/" . substr($val,5,2)  . "/" . substr($val,0,4);
  } else {
  	return $val;
  }
}

Don't forget to refresh browser cache and test : it sould be better !

Regards.


 
Posté : 9 Sep PM 18:099
(@babynus)
Posts: 14952
Membre Admin
 

Fixing is included in V1.7.2, deployed today.


 
Posté : 14 Sep PM 18:099
Share:
Retour en haut