Ad Widget

Collapse

Locale issue (date format)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linuxgurugamer
    Member
    • Oct 2010
    • 66

    #1

    Locale issue (date format)

    I'm running 2.0.4.

    I've noticed that the date formats are incorrect. As I was looking at the system, I saw that while my profile had en_GB as the language, there wasn't corresponding directory in the zabbix/locale directory, but there was an en_US. So i changed my language to en_US. Even though it appeared that the correct date format was in the zabbix/locale/en_US/LC_MESSAGES/frontend.po file, it wasn't doing anything for the zoom bar, which I traced to the file zabbix/js/gtlc.js.

    It seems that the date format is hard-coded in the javascript, so I had to make a code change to fix this. The following diff fixes this, as well as adding an additional selection for the zoom window of 36 hours.

    Code:
    *** gtlc.js.orig        2012-12-18 08:51:23.887541279 -0500
    --- gtlc.js     2012-12-31 09:11:44.193076370 -0500
    ***************
    *** 1060,1070 ****
    
                    // info left
                    var date = this.dateToArray(userstarttime);
    !               this.dom.info_left.innerHTML = date[0] + '.' + date[1] + '.' + date[2] + ' ' + date[3] + ':' + date[4];
    
                    // info right
                    var date = this.dateToArray(usertime);
    !               var right_info = date[0] + '.' + date[1] + '.' + date[2] + ' ' + date[3] + ':' + date[4];
    
                    if (timeControl.timeline.now()) {
                            right_info += ' (' + locale['S_NOW_SMALL'] + '!) ';
    --- 1060,1074 ----
    
                    // info left
                    var date = this.dateToArray(userstarttime);
    !         // JBB change to m/d/y
    !               // this.dom.info_left.innerHTML = date[0] + '.' + date[1] + '.' + date[2] + ' ' + date[3] + ':' + date[4];
    !               this.dom.info_left.innerHTML = date[1] + '/' + date[0] + '/' + date[2] + ' ' + date[3] + ':' + date[4];
    
                    // info right
                    var date = this.dateToArray(usertime);
    !               // JBB change to m/d/y
    !         // var right_info = date[0] + '.' + date[1] + '.' + date[2] + ' ' + date[3] + ':' + date[4];
    !               var right_info = date[1] + '/' + date[0] + '/' + date[2] + ' ' + date[3] + ':' + date[4];
    
                    if (timeControl.timeline.now()) {
                            right_info += ' (' + locale['S_NOW_SMALL'] + '!) ';
    ***************
    *** 1138,1144 ****
            appendZoomLinks: function() {
                    var timeline = timeControl.timeline.endtime() - timeControl.timeline.starttime();
                    var caption = '';
    !               var zooms = [3600, 7200, 10800, 21600, 43200, 86400, 604800, 1209600, 2592000, 7776000, 15552000, 31536000];
                    var links = 0;
    
                    for (var key in zooms) {
    --- 1142,1150 ----
            appendZoomLinks: function() {
                    var timeline = timeControl.timeline.endtime() - timeControl.timeline.starttime();
                    var caption = '';
    !         // JBB - from:  http://www.zabbix.com/forum/showthread.php?t=15776&highlight=zoom
    !               // var zooms = [3600, 7200, 10800, 21600, 43200, 86400, 604800, 1209600, 2592000, 7776000, 15552000, 31536000];
    !         var zooms = [3600, (2*3600), (3*3600), (6*3600), (12*3600), 86400, (36*3600), (7*86400), (14*86400), (30*86400), (90*86400), (180*86                                      400), (365*86400)];
                    var links = 0;
    
                    for (var key in zooms) {
    ***************
    *** 1150,1156 ****
                            }
    
                            caption = formatTimestamp(zooms[key], false, true);
    !                       caption = caption.split(' ', 2)[0];
    
                            this.dom.linklist[links] = document.createElement('span');
                            this.dom.linklist[links].className = 'link';
    --- 1156,1164 ----
                            }
    
                            caption = formatTimestamp(zooms[key], false, true);
    !                       caption = caption.split(' ', 2)[0];
    
                            this.dom.linklist[links] = document.createElement('span');
                            this.dom.linklist[links].className = 'link';
    --- 1156,1164 ----
                            }
    
                            caption = formatTimestamp(zooms[key], false, true);
    !             // JBB Following two lines had commented out reversed
    !             caption = caption.split(' 0',2)[0].split(' ').join('');
    !                       // caption = caption.split(' ', 2)[0];
    
                            this.dom.linklist[links] = document.createElement('span');
                            this.dom.linklist[links].className = 'link';
  • rrupp
    Junior Member
    • Jul 2012
    • 21

    #2
    We stumbled upon this issue earlier and logged a Jira, looks like it just got resolved recently here - https://support.zabbix.com/browse/ZBX-5458 - so should end up in 2.0.5

    Comment

    Working...