digest icon indicating copy to clipboard operation
digest copied to clipboard

"Feeds last updated"-time with hours and minutes

Open hurda opened this issue 12 years ago • 1 comments

Brief 1.6.2 showed the last-updated time with hours and minutes, if the hours-value was non-null, i.e. "Feeds last updated 1 hour and 20 minutes ago". (brief-overlay.js line 213 onwards)

With 1.7a1, this was changed to only show the highest non-null value, in order to be more error-free regarding other locales. So the example above would only be shown as "Feeds last updated 1 hour ago." (https://github.com/Tanriol/digest/blob/master/chrome/content/brief-overlay.js#L240)

Maybe there's a way to display this info in the way 1.6.2 did.

hurda avatar May 29 '13 20:05 hurda

Code of 1.6.2

    constructTooltip: function Brief_constructTooltip() {
        let bundle = document.getElementById('brief-bundle');
        let rows = document.getElementById('brief-tooltip-rows');
        let tooltip = document.getElementById('brief-tooltip');

        // Integer prefs are longs while Date is a long long.
        let now = Math.round(Date.now() / 1000);
        let lastUpdateTime = Brief.prefs.getIntPref('update.lastUpdateTime');
        let elapsedTime = now - lastUpdateTime;
        let hours = Math.floor(elapsedTime / 3600);
        let minutes = Math.floor((elapsedTime - hours * 3600) / 60);

        let label = document.getElementById('brief-tooltip-last-updated');
        if (hours > 1)
            label.value = bundle.getFormattedString('lastUpdatedWithHours', [hours, minutes]);
        else if (hours == 1)
            label.value = bundle.getFormattedString('lastUpdatedOneHour', [minutes]);
        else
            label.value = bundle.getFormattedString('lastUpdatedOnlyMinutes', [minutes]);

And the entries in brief.properties:

lastUpdatedWithHours=Feeds were last updated %1$S hours %2$S minutes ago.
lastUpdatedOneHour=Feeds were last updated 1 hour %S minutes ago.
lastUpdatedOnlyMinutes=Feeds were last updated %S minutes ago.

hurda avatar May 29 '13 20:05 hurda