Flask-Moment
Formatting of dates and times in Flask templates using moment.js.
What it is and what it does
Flask-Moment is a Flask extension that integrates moment.js into your Jinja2 templates, allowing you to format dates and times directly in template markup. Instead of formatting timestamps in Python and passing strings to templates, you pass datetime objects and use Flask-Moment's template functions to render them as human-readable text—relative times like 'a few seconds ago', formatted dates, durations, and more—all processed by moment.js in the browser.
The package depends on Flask and packaging, and requires Python 3.6 or later. It's designed for web applications where you want flexible, locale-aware date and time display without server-side formatting overhead. The extension integrates into your template layer, making it straightforward to add moment.js capabilities to existing Flask projects.
Use it for:
- Display relative timestamps in activity feeds or comment sections without server-side recalculation.
- Render dates and times in user-preferred formats and locales directly in templates.
- Show countdown timers or duration displays that update in the browser using moment.js.
- Format timestamps in API responses for display in Flask-rendered HTML without extra logic.
- Build dashboards where timestamps need to update client-side as time passes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Flask-Moment adds moment.js date and time formatting to Jinja2 templates, letting you render human-readable timestamps directly in your Flask application's HTML.
Yes. Flask-Moment is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a common Flask templating need cleanly. The MIT license poses no restrictions. Install it if you need flexible date and time rendering in your Flask templates.
Install
flask-moment on PyPI
pip
pip install flask-momentuv
uv add flask-momentpoetry
poetry add flask-momentInstalling Flask-Moment
Before you install
Low friction install with only Flask and packaging as runtime dependencies. Actively maintained with recent commits and stable since initial release.
License in practice
MIT license is permissive; you can use this in commercial and private projects with minimal restrictions.
Quickstart
pip install Flask-Moment
from flask import Flask
from flask_moment import Moment
app = Flask(__name__)
moment = Moment(app)
Requires Python 3.6 or later; moment.js must be loaded in your HTML template separately.
Verify before relying
- Whether moment.js is bundled or must be loaded separately in templates
- Supported moment.js versions and any version compatibility constraints
- Performance implications of rendering large numbers of timestamps
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — Flask, packaging |
| Maintenance | actively maintained — 808 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 147,069/month — #11,081 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Flask_Moment-1.0.6-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
jinja2-humanize-extensionAdds humanize library filters to Jinja2…
permissive · top 5,000 on PyPI
momentA Python library for parsing, manipulating, and…
permissive · top 15,000 on PyPI
jinja2-timeJinja2 extension that adds template tags for…
permissive · top 5,000 on PyPI
jinja_partialsAdds a `render_partial()` function to Jinja2…
permissive · top 5,000 on PyPI
agoConverts datetime, timedelta, and timestamp…
permissive · top 15,000 on PyPI
jinja2-fragmentsRenders individual Jinja2 template blocks as…
permissive · top 15,000 on PyPI
aiohttp-jinja2Integrates Jinja2 template rendering into…
permissive · top 5,000 on PyPI
ruamel.yaml.jinja2Enables Jinja2 templating within YAML files by…
permissive · top 5,000 on PyPI
pytimeparse2Parses human-readable time expressions (like…
permissive · top 5,000 on PyPI