Python Datetime to Javascript Datetime
Reported by jspy | July 7th, 2009 @ 03:27 AM
Hi,
python-spidermonkey looks very promising. One question: how can I convert a Python datetime Object to a Javascript Date Object? Is this done automatically or are there any recommended patterns for it?
Regards,
Franz
Comments and changes to this ticket
-
Paul J. Davis July 7th, 2009 @ 02:55 PM
- Tag set to conversion, date
jspy,
There's no automatic conversion and I'm not certain on the best way to write one. I've heard of other people trying to do date conversions with limited success because the JavaScript date class is quite limited in what it can accept. IIRC, the idea was to format the Date in one of the ISO formats and have JavaScript's Date parse the string. Alot of the pain I remember was that JavaScript doesn't define a standard ISO format to use so different JS engines don't agree.
If you find a reasonable method I'd definitely consider adding something built-in to do the conversion, but I don't have the time right now to investigate all of the intricacies of dates.
Paul
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Python/JavaScript bridge module, making use of Mozilla's spidermonkey JavaScript implementation. Allows implementation of JavaScript classes, objects and functions in Python, and evaluation and calling of JavaScript scripts and functions respectively. Borrows heavily from Claes Jacobssen's Javascript Perl module, in turn based on Mozilla's 'PerlConnect' Perl binding.