To show interactive calendar we use module calendar.js . In calendar.js we use open source library moment.js for working with dates. These js modules are imported via template calendar.html.
The goal is to get rid of moment.js and use JS, WEB API and small functions in calendar.js
Impact/Urgency:
low priority
Full Description:
Module calendar.js was taken from sliderrevolution.com and adapted for the app by @cootook .
This module is using open source library calendar.js
In fact the object moment and its methods are used a few times and can be replaced by Vanilla JS and WEB API.
There is a library to help to replace module's methods.
Also this article can be useful.
Template calendar.html is included in other templates (index.html, windows.html).
Via <script>var action_path = "/windows/"; var slots = {{slots}} </script> two variables are declared before including calendar.html. Variable of Jinja template slot is passed from route handler
return render_template("windows.html", slots=slots)slots is a list of time slots that should be shown in calendar.
That list is gotten from database with query:
"SELECT slot_id, year, month, day, hour, minute, is_open FROM calendar WHERE year>=?", (today.year,)
In calendar.js all dates before today filtered out.
Summary:
To show interactive calendar we use module calendar.js . In calendar.js we use open source library moment.js for working with dates. These js modules are imported via template calendar.html.
The goal is to get rid of moment.js and use JS, WEB API and small functions in calendar.js
Impact/Urgency:
low priority
Full Description:
Module calendar.js was taken from sliderrevolution.com and adapted for the app by @cootook . This module is using open source library calendar.js In fact the object moment and its methods are used a few times and can be replaced by Vanilla JS and WEB API. There is a library to help to replace module's methods. Also this article can be useful.
We have two parts where moment.js used:
Template calendar.html is included in other templates (index.html, windows.html). Via
<script>var action_path = "/windows/"; var slots = {{slots}} </script>
two variables are declared before including calendar.html. Variable of Jinja template slot is passed from route handlerreturn render_template("windows.html", slots=slots)
slots is a list of time slots that should be shown in calendar. That list is gotten from database with query:"SELECT slot_id, year, month, day, hour, minute, is_open FROM calendar WHERE year>=?", (today.year,)
In calendar.js all dates before today filtered out.Test Cases:
routes:
/
Resources
You-Dont-Need-Momentjs
you probably don't need moment.js anymore
JavaScript Date objects
moment.js