[JIRA] [dashboard-view-plugin] (JENKINS-19887) Allow time zone to be set on a per user basis

0 views
Skip to first unread message

pb@fino.digital (JIRA)

unread,
Aug 26, 2015, 5:09:02 PM8/26/15
to jenkinsc...@googlegroups.com
Patrick Brückner commented on Improvement JENKINS-19887
 
Re: Allow time zone to be set on a per user basis

Another approach for this could be to deliver all dates in a default timezone and use momentjs or a similar library to convert the date time on the frontend side to either the browsers timezone (this could be the default) or to a manually selected one.

This would be rather easy to implement and would not require any big changes in jenkins itself, just all places that deliver times must be wrapped in some markup, e.g. a class and some data-fields (e.g. data-datetime containing a rfc3339 timestamp)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

petehayes@gmail.com (JIRA)

unread,
Dec 15, 2016, 12:55:05 PM12/15/16
to jenkinsc...@googlegroups.com
Peter Hayes updated an issue
 
Jenkins / Improvement JENKINS-19887
Change By: Peter Hayes
Component/s: core
Component/s: dashboard-view-plugin
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

petehayes@gmail.com (JIRA)

unread,
Dec 15, 2016, 12:55:08 PM12/15/16
to jenkinsc...@googlegroups.com
Peter Hayes assigned an issue to Unassigned
Change By: Peter Hayes
Assignee: Peter Hayes

jsoref+jenkins@gmail.com (JIRA)

unread,
Jun 26, 2018, 12:01:03 PM6/26/18
to jenkinsc...@googlegroups.com
Josh Soref commented on Improvement JENKINS-19887
 
Re: Allow time zone to be set on a per user basis

Note that momentjs will not work if the server already merges two date objects into some datedelta – https://github.com/jenkinsci/jenkins/pull/3525 will probably introduce a case where two dates are subtracted resulting in a number.

Personally, I like the idea of using momentjs (or similar).

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

adam.gent@snaphop.com (JIRA)

unread,
Apr 4, 2019, 2:43:03 PM4/4/19
to jenkinsc...@googlegroups.com

I briefly looked around and this would not be that hard to implement if only you could get the root JellyContext.

Once you have the JellyContext then just you just intercept the calls:
JellyContext.getVariable(Config.FMT_TIME_ZONE);

Or set the variable since the context is mutable.

The JellyContext is already bound to a request via a ThreadLocal in ExpressionFactory2 so you just need to setup the parent JellyContext to look at user config.

The problem is that Stapler makes its own JellyContext called CustomJellyContext in DefaultScriptInvoker per request (which is good)!

So in theory a custom DefaultScriptInvoker that pulls user configuration logic and sets the context with that user logic should be able to set the correct time zone variable.

 

 

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

mcxmoe@gmail.com (JIRA)

unread,
Apr 17, 2019, 10:25:03 AM4/17/19
to jenkinsc...@googlegroups.com

As a workaround, I added the below script to my tampermonkey extension in Chrome. This allows me to view the dates in a job in my computer's timezone. Might be of interest to some of you.

 

// ==UserScript==
// @name         Local Jenkins job dates
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  use local date for Jenkins jobs
// @author       You
// @match        https://myjenkinsdomain.com/job/*
// @grant        none
// ==/UserScript==(function() {
    'use strict';    const allTimes = document.querySelectorAll('div[time]');
    allTimes.forEach(d => {d.textContent = new Date(+d.getAttribute('time')).toLocaleString('en-US', {day: "2-digit", month: "short", year: "numeric", hour: "numeric", minute: "numeric"});});
})(); 

jon.hermansen@gmail.com (JIRA)

unread,
Aug 14, 2019, 1:52:08 PM8/14/19
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
Nov 10, 2019, 6:30:06 PM11/10/19
to jenkinsc...@googlegroups.com
Oleg Nenashev resolved as Fixed
 

The feature has been released in Jenkins 2.203. It has a good chance to appear in the next LTS

Change By: Oleg Nenashev
Status: Open Resolved
Resolution: Fixed
Released As: Jenkins 2.203
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages