Make WordPress Core

Changes between Initial Version and Version 9 of Ticket #28988


Ignore:
Timestamp:
05/05/2021 05:38:30 PM (4 years ago)
Author:
georgestephanis
Comment:

Just did some minor tinkering and here's some prototype code (would obvs needs translations and such, but it works --

(function($){

	// This may need some browser support checks to make sure it's there --
	// https://caniuse.com/mdn-javascript_builtins_intl_datetimeformat_resolvedoptions_computed_timezone
	const browserTz = Intl.DateTimeFormat().resolvedOptions().timeZone;
	const $tzSelect = $('#timezone_string');

	if ( $tzSelect.val() !== browserTz ) {
		$tzSelect.after( '<p>Your browser timezone is currently set to <code>' + browserTz + '</code> -- <a class="updateTzSelectToBrowser" href="#">would you like to update the WordPress timezone to match?</a></p>' );
		$tzSelect.parent().find('.updateTzSelectToBrowser').on( 'click', function(e){
			e.preventDefault();
			$tzSelect.val( browserTz );
			$(this).parents('p').text('Updated!').fadeOut('slow');
		})
	}

})(jQuery);

My gut feeling is it'd be easier to add here to save someone scrolling through the massive dropdown, but totally doable to populate via js in the install flow if we wanted there as well.

Definite +1 to getting something along these lines in.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28988

    • Property Keywords dev-feedback needs-patch added
    • Property Focuses javascript added
  • Ticket #28988 – Description

    initial v9  
    1 Currently, upon installing Wordpress, one of the steps I always take is to go to Settings > General > Timezone to manually set my time zone. I've been using Wordpress for eight years, so I know to do it and how to do it, and it's just a minor inconvenience. However, I have seen people new to this platform be confused and/or not know how to change this.
     1Currently, upon installing WordPress, one of the steps I always take is to go to Settings > General > Timezone to manually set my time zone. I've been using Wordpress for eight years, so I know to do it and how to do it, and it's just a minor inconvenience. However, I have seen people new to this platform be confused and/or not know how to change this.
    22
    33Is it technologically possible to use a geolocation service to query the IP address of the computer installing Wordpress and automatically set that service's best guess as to time zone, perhaps during the setup process?