thunderbirdthunderbird-addonthunderbird-lightning

Show 2 Times from Different Time Zones in Week and Day View in Thunderbird Lightning Extension


The Thunderbird Lightning extension shows the time on the left side of the Week and Day views as shown here...

Screenshot

I would like the time to show 2 different time zones (e.g. local time and Pacific Time) as shown here...

Modified

Is there a configuration parameter to do this? Is there another extension which can tweak this? If not, how do I hack the Thunderbird extension to do this?

For reference, Outlook has this functionality. Also, this answer shows how to hack the Lightning extension.


Solution

  • I didn't solve the problem for the general case. I simply caused the time to be displayed in the current time zone and the previous hour to be displayed. In my case, the current time zone is USA Mountain time and the previous hour ends up being USA Pacific time.

    Screenshot

    The file calendar-multiday-view.xml in the following jar file must be edited while Thunderbird is not running.

    C:\Users\nreynold.ORADEV\AppData\Roaming\Thunderbird\Profiles\profile\extensions\{e2fda1a4-762b-4020-b5ad-a41df1933103}\chrome.jar

    The method makeTimeBox() must be changed as indicated by comments:

    function makeTimeBox(timestr, time2str, size) {             // Add time2str parameter
       var box = createXULElement("box");
       box.setAttribute("orient", orient);
       box.setAttribute("align", "left");                       // Add
    
       if (orient == "horizontal") {
          box.setAttribute("width", size);
       } else {
          box.setAttribute("height", size);
       }
    
       var label = createXULElement("label");
       label.setAttribute("class", "calendar-time-bar-label");
       label.setAttribute("value", timestr);
       label.setAttribute("style", "color: #4080C0; font-weight: bold;");   // Replace "align"
    
       box.appendChild(label);
    
       var label = createXULElement("label");                   // Add
       label.setAttribute("class", "calendar-time-bar-label");  // Add
       label.setAttribute("value", time2str);                   // Add
    
       box.appendChild(label);                                  // Add
    
       return box;
    }
    

    Add the following method after makeTimeBox().

    function makeTime(hour) {
       var h = hour % 12;
    
       if (h == 0)
          h = 12;
    
       var s = hour >= 12 ? " pm" : " am";
       var result = h + s;
    
       return result;
    }
    

    Remove the following line which appears a few lines below makeTimeBox()

    var formatter = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
                    getService(Components.interfaces.nsIScriptableDateFormat);
    

    Change the following line...

    var timeString;
    

    ... to be ...

    var timeString, time2String;
    

    About 25 lines lower, replace the following lines...

    timeString = formatter.FormatTime("",
                                      Components.interfaces.nsIScriptableDateFormat.timeFormatNoSeconds,
                                      theHour, 0, 0);
    box = makeTimeBox(timeString, durPix);
    

    ... to be ...

    timeString = makeTime(theHour) + " MT";
    
    ptHour  = theHour - 1;
    ptHour += 23;
    ptHour %= 24;
    ptHour += 1;
    
    time2String = makeTime(ptHour) + " PT";
    box = makeTimeBox(timeString, time2String, durPix);