skillfed

Flask-Moment

Formatting of dates and times in Flask templates using moment.js.

flask-moment v1.0.6 147.1K downloads/30d#11,081 on PyPI380
Permissive license Active released

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-moment

uv

uv add flask-moment

poetry

poetry add flask-moment

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

flask template date formattingmoment.js jinja2 integrationflask datetime renderinghuman readable timestamps flaskrelative time display flaskflask template time helpersmoment.js flask extension
flask-extensiontemplate-renderingdatetime-formatting

More Dynamic Content packages