timezone.js calls the system.timezone route with a date parameter that is never used

Created on 23 March 2025, 3 months ago

Problem/Motivation

timezone.js generates this kind of AJAX URL: /system/timezone/0/3600/0?date=Sun%20Mar%2023%202025%2015%3A58%3A36%20GMT%2B0100%20(heure%20normale%20d%E2%80%99Europe%20centrale)

But it seems the date query parameter is never used in TimezoneController.

Steps to reproduce

I'm not sure how to trigger the AJAX call, it seems it is only triggered if new Intl.DateTimeFormat().resolvedOptions().timeZone returns an unsupported timezone name.

Proposed resolution

Remove the parameter and make sure it does not break anything.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

other

Created by

πŸ‡«πŸ‡·France prudloff Lille

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @prudloff
  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    I am removing the Novice tag from this issue because I think the resolution is ambiguous with the does not break anything comment.

    I’m using this documentation as a source: https://www.drupal.org/community/contributor-guide/task/triage-novice-is... β†’

  • Merge request !12102Remove unused GET parameter β†’ (Closed) created by prudloff
  • Pipeline finished with Success
    26 days ago
    Total: 580s
    #494221
  • πŸ‡«πŸ‡·France prudloff Lille
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    do we know if a contrib module could be using this?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Lets see what committers think.

    • catch β†’ committed e83d1138 on 11.x
      Issue #3514881 by prudloff: timezone.js calls the system.timezone route...
  • πŸ‡¬πŸ‡§United Kingdom catch

    This needs git archaeology before it can be committed - we need to know whether this was never used, whether it should be used, whether it recently became unused because of other changes etc.

    The dateString argument has been sent since:

    commit b4435decef6ebbfa2c5e9da23c2916fca3b04f57
    Author: Angie Byron <webchick@24967.no-reply.drupal.org>
    Date:   Fri Nov 21 04:33:28 2008 +0000
    
        #11077 follow-up: adding missing timezone.js file.
    
    

    The original menu callback was this:

     
     /**
    + * Menu callback; Retrieve a JSON object containing a suggested time zone name.
    + */
    +function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_time = NULL) {
    +  // An abbreviation of "0" passed in the callback arguments should be
    +  // interpreted as the empty string.
    +  $abbreviation = $abbreviation ? $abbreviation : '';
    +  $timezone = timezone_name_from_abbr($abbreviation, intval($offset), $is_daylight_saving_time);
    +  drupal_json($timezone);
    +}
    +
    

    So this was added in 2008 with the original issue, and has never been used.

    But also - I think we should open a follow-up to look into removing the route and AJAX request, if it's only a fallback for non-compliant browsers, then we should be able to fall back to the user selecting their own timezone.

  • Status changed to Fixed 8 days ago
Production build 0.71.5 2024