Bugzilla/Notes/14286

From MediaWiki.org
< Bugzilla‎ | Notes(Redirected from Bugzilla/14286)
Jump to navigation Jump to search

bugzilla:14286: local timezone conversion / {{USERTIME}},{{USERLOCALTIME}} for time formatting / signature time expansion

Add localtime conversion capability to LOCAL{TIMESTAMP,YEAR,...} variable[edit]

  • {{LOCALTIMESTAMP}}: current local time stamp in iso-8601 format
  • {{LOCALTIMESTAMP: UTC time in ISO-8601 format }}: convert the specified UTC time to local time stamp

Example[edit]

If user's timezone preference is +0900,

  • {{LOCALTIMESTAMP:20080527160000}} --> 20080528010000
  • {{LOCALYEAR:20080527160000}} --> 2008
  • {{LOCALMONTH:20080527160000}} --> 05
  • {{LOCALDAY:20080527160000}} --> 28

Add USERTIME/USERLOCALTIME, the date/time formatting variable[edit]

  • {{USERTIME: UTC time in ISO-8601 format }}: format the time according to current user's date format preference, in UTC timezone
  • {{USERLOCALTIME: UTC time in ISO-8601 format }}: format the time according to current user's date format preference, in local timezone (as specified in user's preference)

Example[edit]

  • {{USERTIME: {{CURRENTTIMESTAMP}} }} --> 16:25, 27 May 2008 (UTC)
  • {{USERTIME: 20080527160000 }} --> 16:00, 27 May 2008 (UTC)
  • {{USERTIME}} --> {{USERTIME: {{CURRENTTIMESTAMP}} }}
  • {{USERLOCALTIME: {{CURRENTTIMESTAMP}} }} --> 01:25, 28 May 2008 (XXX)
  • {{USERLOCALTIME: 20080527160000 }} --> 01:00, 28 May 2008 (XXX)
  • {{USERLOCALTIME}} --> {{USERLOCALTIME: {{CURRENTTIMESTAMP}} }}

Apply this to default signature expansion[edit]

  • ~~~~ --> User123 (talk) {{USERLOCALTIME:20080527162500}}

This will be useful that,

  • the readers will see the signature's timestamp in their preferred timezone and format
  • the signature's timezone and format will be consistent with what shown in revision history

Problem[edit]

  • bugzilla:14286#c3: all above variable will be broken by caching
    • The possible solution may be to use AJAX --Ans 05:56, 28 May 2008 (UTC)
    • bugzilla:14286#c6: Post cache modifying is another solution --Ans 06:56, 28 May 2008 (UTC)
    • bugzilla:14286#c8: The already implemented {{int:...}} also kill content caching? --Ans 06:05, 2 March 2009 (UTC)