Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt
Use this file to discover all available pages before exploring further.
TimeMap provides live date and time values as placeholders inside any string resolved by a MapResolver. Unlike static DataMap instances whose values are fixed at creation time, TimeMap evaluates each placeholder’s lambda at resolution time — so every call to resolver.res() reflects the actual current clock reading rather than a snapshot taken when the map was constructed.
Available placeholders
TimeMap exposes 14 placeholders wrapped in %percent% delimiters. All values are derived from datetime.now() in the configured timezone.
| Placeholder | Format | Example |
|---|---|---|
%hh% | Hour, 24-hour, zero-padded (00–23) | 09, 14 |
%h% | Hour, 24-hour, no padding (0–23) | 9, 14 |
%h12% | Hour, 12-hour, no padding (1–12) | 9, 2 |
%hh12% | Hour, 12-hour, zero-padded (01–12) | 09, 02 |
%ampm% | AM or PM indicator | AM, PM |
%mm% | Minute, zero-padded (00–59) | 05, 47 |
%m% | Minute, no padding (0–59) | 5, 47 |
%ss% | Second, zero-padded (00–59) | 00, 38 |
%s% | Second, no padding (0–59) | 0, 38 |
%ms% | Milliseconds, zero-padded (000–999) | 007, 512 |
%YYYY% | Four-digit year | 2024 |
%MM% | Month, zero-padded (01–12) | 01, 11 |
%DD% | Day of month, zero-padded (01–31) | 03, 27 |
%weekday% | Full weekday name | Monday, Friday |
Basic usage
InstantiateTimeMap, place it inside a Layer, and resolve any string that contains %placeholder% tokens:
TimeMap with additional maps in the same LayerStack:
Timezone support
TimeMap accepts an optional tz keyword argument — an IANA timezone name string. When provided, all datetime values are computed in that timezone via Python’s zoneinfo.ZoneInfo. The default timezone is UTC.
If
tz is omitted or None, TimeMap defaults to UTC using ZoneInfo('UTC'). Pass an explicit IANA name whenever local or regional time is required.The time convenience alias
mapres re-exports TimeMap under the shorter alias time, making it ergonomic to use without the longer class name:
time is a direct reference to the TimeMap class — not an instance — so time() and TimeMap() are completely interchangeable.
The maps namespace
TimeMap and its time alias are also available under the top-level maps namespace object for organised imports:
maps.TimeMap and maps.time refer to the class itself — call them with () to produce an instance, optionally passing a tz string.
Dynamic evaluation
TimeMap is decorated with @datamap(syntax=syntax.percents, mode='dynamic'). The mode='dynamic' setting tells the DataMap resolution engine to invoke each field’s provider lambda on every call to as_map(), rather than caching a static value.
Concretely, each placeholder in the providers property is a zero-argument lambda that calls datetime.now(self.TZ) fresh each time:
resolver.res() with %ss% can — and often will — return different values if a second boundary is crossed between them. The map never goes stale.