Failure

User tests: Successful: Unsuccessful:

avatar b2z
b2z
9 Feb 2014

Details

This will introduce a user params functionality. Currently only two parameters are supported:

  • language
  • timezone

Notice that a new global template variable is introduced - offset. This will allow to modify dates accordingly. The global lang template variable now contains a user's language param.

Please note that params are applied only after re-login.

How to test

  1. Pull the user-params branch
  2. Switch the language using language switcher when you are not logged in. The language should switch accordingly.
  3. Login and switch the language using language switcher. The language should switch accordingly.
  4. Under the user menu choose "Profile". The "Edit user" page should open showing two params: "Language" and "Timezone". These should be as default ones: Language - "en-GB", Timezone - "UTC"
  5. Click the "Cancel" button. You should be redirected to the "My profile" page.
  6. Under the user menu choose "Profile". Change the language and timezone and click "Save". Selected language should be saved, but the display language should stay the same as you selected in item 3.
  7. Logout and login. The language should change to the value that you saved in item 6.
  8. Switch the language using language switcher. The language should switch accordingly.
  9. Under the user menu choose "Profile". Ensure that the language and timezone values are the same as you saved them in item 6.
  10. Test is passed ?

Current issues

Twig does not apply the timezone. For now I can't find why. For example this does not work:
activity.created_date|date("j M y H:i", offset)

But this works:
"now"|date("j M y H:i", offset)

avatar b2z b2z - open - 9 Feb 2014
avatar elkuku elkuku - change - 15 Feb 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-02-15 01:59:53
avatar elkuku elkuku - close - 15 Feb 2014
avatar elkuku elkuku - reference | - 15 Feb 14
avatar elkuku elkuku - merge - 15 Feb 2014
avatar elkuku elkuku - close - 15 Feb 2014
avatar elkuku
elkuku - comment - 15 Feb 2014

The Travis failure is due to the recent changes in the framework packages.
I merged it anyway :tongue:

avatar elkuku elkuku - head_ref_deleted - 15 Feb 2014
avatar b2z b2z - head_ref_restored - 15 Feb 2014
avatar b2z b2z - head_ref_deleted - 15 Feb 2014
avatar b2z
b2z - comment - 15 Feb 2014

Oh I did notice the check method earlier. And what are your thoughts about the timezone - why it's not working?

avatar elkuku
elkuku - comment - 15 Feb 2014

According to the documentation it should work as you tried - A bug ?
Does it make sense to convert the time to the users time zone here ?

avatar dougransom
dougransom - comment - 15 Feb 2014

Right now it is live at
http://ia.dougransom.com/ias

while i test.

On 2014-02-15, at 12:16 PM, Nikolai Plath notifications@github.com wrote:

According to the documentation it should work as you tried - A bug ?
Does it make sense to convert the time to the users time zone here ?


Reply to this email directly or view it on GitHub.

Doug Ransom

avatar b2z
b2z - comment - 15 Feb 2014

May be a bug, but I'm not sure. Converting tz for me does make sense :)

avatar elkuku
elkuku - comment - 15 Feb 2014

So I tested:

{{ user.params.timezone }}<br />
{{ activity.created_date }}<br />
{{ activity.created_date|date("j M y H:i") }}<br />
{{ activity.created_date|date("j M y H:i", false) }}<br />
{{ activity.created_date|date("j M y H:i", user.params.timezone) }}<br />
{{ activity.created_date|date("j M y H:i", "GMT") }}<br />
{{ activity.created_date|date("j M y H:i", "Europe/Paris") }}<br />
{{ activity.created_date|date("j M y H:i", "Africa/Cairo") }}<br />

{{ '2012-10-07 14:52:21'|date("j M y H:i", user.params.timezone) }}<br />
{{ '2012-10-07 14:52:21'|date("j M y H:i", "GMT") }}<br />
{{ '2012-10-07 14:52:21'|date("j M y H:i", "Europe/Paris") }}<br />
{{ '2012-10-07 14:52:21'|date("j M y H:i", "Africa/Cairo") }}<br />

{{ 'now'|date("j M y H:i", user.params.timezone) }}<br />
{{ 'now'|date("j M y H:i", "GMT") }}<br />
{{ 'now'|date("j M y H:i", "Europe/Paris") }}<br />
{{ 'now'|date("j M y H:i", "Africa/Cairo") }}<br />

Result:

America/Guayaquil
2014-02-02 21:17:25
2 Feb 14 21:17
2 Feb 14 21:17
2 Feb 14 21:17
2 Feb 14 21:17
2 Feb 14 21:17
2 Feb 14 21:17
7 Oct 12 14:52
7 Oct 12 14:52
7 Oct 12 14:52
7 Oct 12 14:52
15 Feb 14 16:16
15 Feb 14 21:16
15 Feb 14 22:16
15 Feb 14 23:16

Looks like a bug to me...

avatar carlcs
carlcs - comment - 31 Jul 2014

It doesn't work, as twig can't guess what timezone to calculate from. Your string "2012-10-07 14:52:21" was many moments on that day. If you define a timezone with your sting it works:

{# Base time as UNIX timestamp #}
{{ "@1349614341"|date("j M y H:i", "America/Guayaquil") }}<br />
{{ "@1349614341"|date("j M y H:i", "Europe/Paris") }}<br /><br />

{# Base time in UTC+2 timezone #}
{{ "2012-10-07 14:52:21 +0200"|date("j M y H:i", "America/Guayaquil") }}<br />
{{ "2012-10-07 14:52:21 +0200"|date("j M y H:i", "Europe/Paris") }}<br /><br />
avatar b2z
b2z - comment - 31 Jul 2014

@carlcs thanks. I see your discussion on this PR, so currently waiting ;)

Add a Comment

Login with GitHub to post a comment