I have a template, named user.html, w/ this line of code:
<p>Member since {{ moment(user.member_since).format('L') }}. Last seen {{ moment(user.last_seen).fromNow() }}.</p>
Which renders the following page:
It looks like it's not rendering anything, yet looking at the source code of that same page:
...I can see my timestamps between tags.
My question is: What is stopping the browser from displaying my timestamp in the browser?
Things to consider:
Any insight will be greatly appreciated!
Timestamp registry in table
Found the answer to my question:
The template that needs to use Flask-Moment needs to contain the following lines:
{{ moment.include_jquery() }}
{{ moment.include_moment() }}
This wasn't in the book, yet I found the reference in the The Flask Mega-Tutorial, by the same author:
https://blog.miguelgrinberg.com/post/flask-moment-flask-and-jinja2-integration-with-momentjs
The times are not displayed as the is style='display: none;'
in the tag. This will tell the browser to not display the tag. I don't know where it's comming from, but you should change it to style='display: inline;'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With