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

How to properly work with dates? #54

Open
macedd opened this issue Feb 10, 2014 · 2 comments
Open

How to properly work with dates? #54

macedd opened this issue Feb 10, 2014 · 2 comments

Comments

@macedd
Copy link

macedd commented Feb 10, 2014

I've found some flaws when dealing with dates and RPC.

Can you expose how do you work with them?

Currently I'm converting all dates to UTC prior to sending to WordPress

@maxcutler
Copy link
Owner

If you mean what Python types to use, you want to use the wordpress_xmlrpc.compat.xmlrpc_client.DateTime type; see the docs at http://docs.python.org/2/library/xmlrpclib.html#datetime-objects

If you mean which fields on the WordPressPost object to set, that's a bit more subtle. My recommendation is to only use post_date_gmt with a GMT/UTC datetime, as that's the only guaranteed way to get the value you desire. If you use the plain post_date field, it will get converted on the server based on user timezone settings, which may be different than the local timezone on the client running this library.

I'll use this issue to track adding proper documentation around dates. If I didn't fully answer your question, please let me know.

@macedd
Copy link
Author

macedd commented Feb 24, 2014

Yes, thanks, I ended using the Post.date on GMT. Its also a good idea to put some docs on the field mappings and how they are treated by the library.

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

No branches or pull requests

2 participants