Make WordPress Core

Opened 15 years ago

Closed 13 years ago

#8153 closed defect (bug) (fixed)

Use localized dates on General Options page

Reported by: nbachiyski's profile nbachiyski Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch, needs-testing
Focuses: Cc:

Description

In options-general.php dates and times are get from the vanilla date() and gmdate() PHP functions, which don't honor the translations of months and weekdays.

The patch also adds GMT option for date_i18n().

Attachments (5)

localized-dates-options-general.diff (4.2 KB) - added by nbachiyski 15 years ago.
localized-dates-options-general-fixup.diff (721 bytes) - added by nbachiyski 15 years ago.
Make second argument of date_i18n optional
proper-current-time-for-date_i18n.diff (1.8 KB) - added by nbachiyski 15 years ago.
If timestamp is missing use current time + offset and set gmt to true, so that the dates are shown properly. Also, use the right function in all places
bring-T-date-format-back.diff (969 bytes) - added by nbachiyski 13 years ago.
bring-T-date-format-back.2.diff (1.4 KB) - added by nbachiyski 13 years ago.

Download all attachments as: .zip

Change History (29)

#1 @nbachiyski
15 years ago

  • Keywords has-patch commit added

#2 @nbachiyski
15 years ago

  • Keywords commit removed

#3 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [9616]) Use localized dates on General Options page. Props nbachiyski. fixes #8153

#4 @lloydbudd
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Generates warnings:

Warning: Missing argument 2 for date_i18n(), called in wp-admin/options-general.php on line 124 and defined in wp-includes/functions.php on line 115

@nbachiyski
15 years ago

Make second argument of date_i18n optional

#5 @ryan
15 years ago

I think the unixtimestamp arg just needs a default of zero.

#6 @ryan
15 years ago

Oops, you beat me to it. :-)

#7 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [9618]) Fix warnings. Props nbachiyski. fixes #8153

#8 @nbachiyski
15 years ago

If it defaulted to 0, and we interpreted 0 as current time, we wouldn't be able to call it for Jan 1, 1970 00:00:00.

#9 @markjaquith
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This generates incorrect dates for the timezone-shifted date.

UTC time is 2008-11-12 16:11:44 UTC -4 is 2008-11-12 11:11:44

16 - 4 != 11

#10 @ryan
15 years ago

(In [9647]) Show user specified offset, not server offset, when displaying time. see #8153

#11 @nbachiyski
15 years ago

Now it was your turn to commit it seconds before me attaching the file :-)

#12 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

@nbachiyski
15 years ago

If timestamp is missing use current time + offset and set gmt to true, so that the dates are shown properly. Also, use the right function in all places

#13 @nbachiyski
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

What do you think if reverting [9647] and using the fixed version in the patch, instead?

Being able to use just date_i18n(format); sounds very appealing to me.

#14 @jacobsantos
15 years ago

  • Keywords needs-unittests added

#15 @jacobsantos
15 years ago

  • Keywords needs-unit-tests added; needs-unittests removed

#16 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [9742]) date_i18n() fixes. Props nbachiyski. fixes #8153

#17 @ryan
15 years ago

I put in a conditional to use time() if $gmt and current_time() if not. Otherwise, you couldn't get UTC Time.

#18 @nacin
14 years ago

  • Keywords has-patch needs-unit-tests removed

#19 @nbachiyski
13 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Using gmdate() when the timezone is different from GMT breaks the T format modifier.

Here is a patch, which tries to use the current timezone settings in order to manually replace it.

#20 @nbachiyski
13 years ago

Updated patch to include all timezone format letters, except T.

#21 @westi
13 years ago

  • Cc westi added
  • Milestone changed from 2.7 to 3.1

Changing milestone to 3.1 from 2.7 as we still have issues and a new patch

#22 @jane
13 years ago

  • Keywords has-patch needs-testing added

#23 @nacin
13 years ago

Marked #13974 as a duplicate.

#24 @westi
13 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

[16203] - Restore the functionality of some of the other timezone format modifiers in date_i18n props nbachiyski.

Testing wise this has been running on WPCOM for a few weeks now without issues.

Note: See TracTickets for help on using tickets.