I include .js moments as follows
<script src="../static/js/moment-timezone-full.js"></script> <script> $('.select_timezone').timezones(); </script>
Then I give the time zone choice to my user in html like
<div class="row"> <div class="col-lg-4"> <select class="select_timezone" name="select_timezone"></select> </div> </div>
My question is, how can I choose the default time zone? I saw that this can be done with
moment.tz.setDefault(String);
but I donβt understand how this will work in my setup?
EDIT: my implementation is only after this example ...
http://www.jqueryscript.net/time-clock/Easy-Timezone-Picker-with-jQuery-Moment-js-Timezones.html
Does anyone really know a solution to this? carl
EDIT: I have to clarify why moment.tz.setDefault is not working. When i add the line
moment.tz.setDefault('America/Los_Angeles');
I get javascript error
Uncaught TypeError: Cannot read property 'setDefault' of undefined
I include moments, as explained in the mega-flask tutorial, what I do
from flask.ext.moment import Moment ... moment = Moment() ... moment.init_app(app)
and in my html template i do
{% block scripts %} {{ moment.include_moment() }} {% endblock %}
instant clocks are included in the js file as shown above. Did I forget something? I'm just trying to set the default timezone for selection