Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When choosing datetimes, ensure that time is relative to user's timezone #98

Open
mcdonc opened this issue Aug 10, 2013 · 8 comments
Open

Comments

@mcdonc
Copy link
Member

mcdonc commented Aug 10, 2013

Might need to make a new schema node type based on colander.DateTime that automatically sets the tzinfo to the user's timezone, and returns a datetime converted to UTC.

@hirokiky
Copy link
Contributor

Now the /index.atom of demo blog app causes Error on my enviroment.
it is mainly due to this issue, right?

2014-04-23 18:18:59,630 ERROR [waitress][Dummy-2] Exception when serving /index.atom
Traceback (most recent call last):
  ...
  File "/Users/hirokiky/dev/substanced-blog/substanced-blog/blog/views/retail.py", line 224, in blog_atom
    feed, blogentries = self._get_feed_info()
  File "/Users/hirokiky/dev/substanced-blog/substanced-blog/blog/views/retail.py", line 197, in _get_feed_info
    _add_updated_strings(updated, info)
  File "/Users/hirokiky/dev/substanced-blog/substanced-blog/blog/views/retail.py", line 183, in _add_updated_strings
    info['updated_atom'] = updated.astimezone(pytz.utc).isoformat()
ValueError: astimezone() cannot be applied to a naive datetime

hirokiky added a commit to hirokiky/substanced-blog that referenced this issue Apr 23, 2014
Now the datetimes inputed by sdi has not be set local tzinfo refs Pylons/substanced#98
@cguardia cguardia modified the milestones: After First Release, Beta 1 May 12, 2015
@hirokiky
Copy link
Contributor

I created DateTime SchemaNode and Widget handling timezone. hirokiky@b913502

  • Client users' timezone will be applied at the first time.
  • Users can change the value
  • If changing existing data, the default value of timezone input will be filled by the data

Like this

sd_tz_sensitive

Thinking...

  • This feature should be separated from substanced, and included in deform
  • TimeZone should not be appeared by default
    • config-able would be nice

Special thanks for tsearver for giving some advices at PloneSymposiumTokyo Sprint.

@cguardia
Copy link
Member

I'd say if it's generally useful, try to make a PR to deform. I agree that it's best if it doesn't appear by default. Maybe if configured to not show time zone, get it from the user's system by default.

@mcdonc
Copy link
Member Author

mcdonc commented Jun 15, 2015

I'd suggest putting it in Substance D right now and backporting it to deform later to be honest. I'm sure it's generally useful enough to add to deform but I dont anticipate a new deform release any time soon.

@tseaver
Copy link
Member

tseaver commented Jun 16, 2015

I like the notion of a show_timezone option for the widget (defaulting to false, I think).

@hirokiky
Copy link
Contributor

Thank you.

anyway now I noticed User has timezone property.
Did @mcdonc say to use this value? My changes uses timezone info from browser (JavaScript).
I feel user.timezone is better.
Ofcause users are not logged in for all of times..

@hirokiky
Copy link
Contributor

I fixed the code

  1. Use user.timezone if logged in
  2. Use browser timezone

And made it switchable to show or not.

@hirokiky
Copy link
Contributor

PR Opened!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants