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 Initial Version

Reported by: Jun Omae Owned by:
Priority: normal Milestone: 1.3.2
Component: i18n Version:
Severity: normal Keywords: datepicker timezone jquery jqueryui
Cc: walty8@… Branch:
Release Notes:
API Changes:
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 (0)

Note: See TracTickets for help on using tickets.