Edgewall Software

Opened 8 years ago

Last modified 4 years ago

#12348 closed defect

Now button in datetime picker use wrong time when timezones are different between Trac and browser — at Version 16

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.3.2
Component: i18n Version:
Severity: normal Keywords: datepicker timezone jquery jqueryui
Cc: walty8@… Branch:
Release Notes:
API Changes:

Upgraded:

  • jQuery to 1.12.4
  • jQuery UI to 1.12.1
  • jQuery Timepicker to 1.6.3
Internal Changes:

Description

Now button in datetime picker uses Date() with browser's timezone to fill. If a user configure different timezone, the datetime picker fills wrong time.

This issue would be fixed by the following patch with jQuery-Timepicker-Addon v1.6.0. v1.5.5 is used in trunk.

  • trac/web/chrome.py

    diff --git a/trac/web/chrome.py b/trac/web/chrome.py
    index a6b8d986c..dc2a1a848 100644
    a b class Chrome(Component):  
    13791379        is_iso8601 = req.lc_time == 'iso8601'
    13801380        now = datetime_now(req.tz)
    13811381        tzoffset = now.strftime('%z')
    1382         if is_iso8601:
    1383             default_timezone = (-1 if tzoffset.startswith('-') else 1) * \
    1384                                (int(tzoffset[1:3]) * 60 + int(tzoffset[3:5]))
    1385             timezone_list = get_timezone_list_jquery_ui(now)
    1386         else:
    1387             default_timezone = None
    1388             timezone_list = None
     1382        default_timezone = (-1 if tzoffset.startswith('-') else 1) * \
     1383                           (int(tzoffset[1:3]) * 60 + int(tzoffset[3:5]))
     1384        timezone_list = get_timezone_list_jquery_ui(now) \
     1385                        if is_iso8601 else None
    13891386        add_script_data(req, jquery_ui={
    13901387            'month_names': get_month_names_jquery_ui(req),
    13911388            'day_names': get_day_names_jquery_ui(req),

See also https://github.com/trentrichardson/jQuery-Timepicker-Addon/commit/47dbb0f8adb6a1f77bb4806ffb651c4e96849914.

Change History (16)

in reply to:  description comment:1 by Ryan J Ollos, 8 years ago

Replying to Jun Omae:

This issue would be fixed by the following patch with jQuery-Timepicker-Addon v1.6.0. v1.5.5 is used in trunk.

It seems like a good idea to update the addon again before we release Trac 1.2. We could also consider moving from jQuery 1.11.3 to 1.12.0. jQuery UI 1.11.4 is still the latest.

comment:2 by Jun Omae, 8 years ago

Okay. Updated log:jomae.git@t12348 with jQuery 1.12.0 and also jQuery-Timepicker-Addon 1.6.1 (latest).

comment:3 by Jun Omae, 8 years ago

Milestone: next-dev-1.1.x1.2
Owner: set to Jun Omae
Status: newassigned

comment:4 by Ryan J Ollos, 8 years ago

I did some testing with Chrome 48 and found two minor issues that are not present on the trunk:

  • The Today button on the datepicker is not effective.
  • On attempting to manually edit a datetime (e.g. Milestone edit page), focus is lost after editing a single character. This even happens when deleting a single character.
Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:5 by Jun Omae, 8 years ago

Milestone: 1.2next-dev-1.1.x

Another issue: Now button works well first time. However, it fills incorrect time on clicking it once again. It needs more tests….

comment:6 by Ryan J Ollos, 8 years ago

jQuery 1.12.1 released today.

comment:7 by Ryan J Ollos, 8 years ago

Milestone: next-dev-1.1.xnext-stable-1.2.x

Milestone renamed

comment:8 by Ryan J Ollos, 8 years ago

Milestone: next-stable-1.2.x1.2

comment:9 by Ryan J Ollos, 8 years ago

jQuery 1.12.4 is now the latest.

comment:10 by Jun Omae, 8 years ago

Rebased jomae.git@t12348 and updated to jQuery 1.12.4 and jQuery-Timepicker-Addon 1.6.3. The issue in comment:5 has been fixed. However, Today button in datepicker isn't still working.

I tried datepicker without timepicker addon on http://jqueryui.com/datepicker/#buttonbar. The Today button in original datepicker doesn't work….

comment:11 by walty <walty8@…>, 8 years ago

Cc: walty8@… added

comment:12 by Ryan J Ollos, 8 years ago

I haven't tested the comment:10 branch, but to summarize we are currently using jQuery 1.11.3 (lastest release on 1.11.x line) and jQuery UI 1.11.4 (the latest jQuery UI). If the Today button breaks with jQuery 1.12.4 (the latest release of the 1.x line), then I guess there must be a compatibility problem between jQuery UI 1.11.4 and jQuery 1.12.4?

I suppose sticking with jQuery 1.11.3 is not so bad, but it would be really nice to move to the latest jQuery 1.x by Trac 1.2, considering that in the past we've only upgraded jQuery to a major release on a major release of Trac.

I will try to spend some time on it before the weekend, since I hope to create 1.2rc1 this weekend.

comment:13 by Ryan J Ollos, 8 years ago

Milestone: 1.21.3.1

comment:14 by Christian Boos, 7 years ago

Milestone: 1.3.1next-dev-1.3.x

Moving to some later 1.3.x version.

comment:15 by Ryan J Ollos, 7 years ago

Milestone: next-dev-1.3.x1.3.3

Moving to 1.3.3 since we should upgrade jQuery and jQuery UI before releasing Trac 1.4.

comment:16 by Ryan J Ollos, 7 years ago

API Changes: modified (diff)
Note: See TracTickets for help on using tickets.