On 6/6/13, Ethan Jucovy <[email protected]> wrote: > On Wed, Jun 5, 2013 at 9:25 PM, Olemis Lang <[email protected]> wrote: >> Is it possible to include datetime values in add_script_data and >> expect these to be converted to JS values in templates ? If not, >> what's the recommended approach to get this done ? > > The JSON format does not define a syntax for specifying datetime > values, so you'll need to turn your Python datetime into a string > before passing it to add_script_data, and your Javascript code will > need to know that the variable should be turned into a Date. > > In Python `my_dt_obj.isoformat()` (ISO 8601 format) will give you a > string with full date/time/zone information, which can then be passed > into the Javascript `new Date(myVar)` constructor on the other end. > > -Ethan >
understood. thanks :) -- Regards, Olemis. Apache⢠Bloodhound contributor http://issues.apache.org/bloodhound Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
