Skip to content

Latest commit

 

History

217 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morrow.mojo

Human-friendly date and time utilities for Mojo. Morrow provides an Arrow-inspired API for creating, parsing, formatting, shifting, comparing, and humanizing date-time values.

Test Documentation GitHub release

Language: English | 中文

Documentation: https://mojoto.github.io/morrow.mojo/

Installation

Morrow is available from the official Modular Community channel. From a Pixi workspace already configured for Mojo, add the Modular Community channel and install Morrow:

pixi workspace channel add --prepend https://repo.prefix.dev/modular-community
pixi add morrow

The package installs a compiler-compatible morrow.mojoc into the active Pixi environment, so it can be imported without copying source files.

Usage

Paste the following example into the REPL:

from morrow import FORMAT_RSS, Morrow, TimeZone

var now = Morrow.now()
print(now)

var utc = Morrow.utcnow()
print(utc)

var parsed = Morrow.get("2026-01-01 03:04:05Z")
print(parsed)
print(parsed.format("YYYY-MM-DD HH:mm:ss ZZ"))

var beijing = parsed.to("+08:00")
print(beijing)

var hour = beijing.span("hour")
print(hour)

print(beijing.isocalendar())
print(beijing.timetuple())

var rss = Morrow(2026, 1, 1, 10, 30, 35, 0, TimeZone(0, "UTC"))
print(rss.format(FORMAT_RSS))

Morrow is UTC by default, supports fixed-offset time zones, parses ISO 8601 strings and POSIX timestamps, and formats values with Arrow-style tokens or Python-style strftime.

Development

Run make help to list the available targets.

Target Description
make install Create or reuse .venv and install the pinned Mojo version with uv
make test Run every tests/test_*.mojo file
make format Format the morrow and tests directories
make build Precompile morrow as morrow.mojoc
make package Build the distributable Conda package with rattler-build
make clean Remove morrow.mojoc
make doc-install Install Docusaurus dependencies
make doc-build Build the Docusaurus static site
make doc-serve Serve the built Docusaurus site
make doc-clean Remove generated Docusaurus files

The documentation targets require Node.js and npm. Run make doc-install before building the documentation, then use make doc-build followed by make doc-serve to preview the built site.

About

Human-friendly date & time for Mojo 🔥

Topics

Resources

Stars

126 stars

Watchers

18 watching

Forks

Releases

Packages

Used by

Contributors

Languages