Skip to content

Use Cases & Production Patterns ​

@tempo-kit/plugin-cultural decouples cultural and traditional calendar Terms from tempo-kit's core bundle while providing full Tempo Term capabilities (shorthand navigation, ordinals, formatting tokens, and .span progress metrics).


1. Localized East Asian Zodiac Badges (cn / jp / kr / vn) ​

The Challenge ​

East Asian New Year campaigns and localization pipelines share the 12-year zodiac animal cycle (paired with the 5 elements in the 60-year sexagenary cycle), but regional audiences expect localized animal names and characters—such as Cat (Mão / Mèo) instead of Rabbit in Vietnam, Sheep instead of Goat in Japan/Korea, and Wild Boar instead of Pig in Japan.

NOTE

EasternTerm derives its animal, element, and .span boundaries ({yyyy}-01-01 → next year's 01-01) from the Gregorian calendar year (t.yy), not the lunisolar New Year boundary. Dates in January or early February prior to Lunar New Year will resolve to that Gregorian year's sign.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { EasternTerm } from '@tempo-kit/plugin-cultural/eastern';

Tempo.use(EasternTerm);

const jpDate = new Tempo('2019-06-01', { locale: 'ja-JP' });
console.log(jpDate.term.sign);                     // 'Wild Boar'
console.log(jpDate.term.shengxiao.emoji);          // '🐗'
console.log(jpDate.term.shengxiao.variants.jp);    // { animal: 'Wild Boar', emoji: '🐗', character: '亥', romanized: 'Inoshishi' }

const vnDate = new Tempo('2023-06-01', { locale: 'vi-VN' });
console.log(vnDate.term.sign);                     // 'Cat'
console.log(vnDate.term.shengxiao.variants.vn);    // { animal: 'Cat', emoji: '🐈', character: 'Mão / Mèo' }

2. Western Tropical Zodiac Navigation & Formatting ​

The Challenge ​

Lifestyle, editorial, and social platforms often need to compute sign transitions, render formatted badges, or jump to the start of an astrological window without hardcoding month/day lookup tables.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { ZodiacTerm } from '@tempo-kit/plugin-cultural/zodiac';

Tempo.use(ZodiacTerm);

const t = new Tempo('2026-04-05');
console.log(t.format('{#zdc.emoji} {#zdc} ({#zdc.symbol})'));     // '♈ Aries (Ram)'
console.log(t.term.zodiac.span.start.format('{yyyy}-{mm}-{dd}')); // '2026-03-21'

// Jump to the next sign boundary
const nextTaurus = t.set('#zdc.>taurus');
console.log(nextTaurus.format('{yyyy}-{mm}-{dd}'));               // '2026-04-20'

3. Japanese Wareki Document & Invoice Stamping (NengoTerm) ​

The Challenge ​

Japanese government filings, receipts, and legal contracts require Imperial Era (Wareki) dates (e.g. 令和8年5月15日 or compact R8.05.15), including 元年 for year 1 of an era, while safely distinguishing closed historical eras from the open-ended active Reiwa era.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { NengoTerm } from '@tempo-kit/plugin-cultural/nengo';

Tempo.use(NengoTerm);

function formatWarekiInvoiceDate(t: Tempo): string {
  const { formatted, span } = t.term.era;
  const status = span.end === null
    ? 'current era'
    : `ended ${span.end.subtract({ days: 1 }).format('{yyyy}-{mm}-{dd}')}`;
  return `${formatted}${t.mm}月${t.dd}日 (${status})`;
}

const invoice = new Tempo('2026-05-15T12:00:00', { timeZone: 'Asia/Tokyo' });
console.log(formatWarekiInvoiceDate(invoice));
// '令和8年5月15日 (current era)'

const historical = new Tempo('2019-04-30T12:00:00', { timeZone: 'Asia/Tokyo' });
console.log(formatWarekiInvoiceDate(historical));
// '平成31年4月30日 (ended 2019-04-30)'

4. Ramadan & Hijri Campaign Window Tracking (HijriTerm) ​

The Challenge ​

Regional e-commerce, fintech, and hospitality platforms in MENA and Southeast Asia adjust promotions, operating hours, and support SLAs during Ramadan and the four sacred months—requiring accurate month boundaries and remaining-time indicators without maintaining manual yearly lookup tables.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { HijriTerm } from '@tempo-kit/plugin-cultural/hijri';

Tempo.use(HijriTerm);

const now = new Tempo('2026-03-01T12:00:00Z');
const { key, year, day, arabic, isSacred, span } = now.term.islamic;

if (key === 'Ramadan') {
  console.log(`Day ${day} of ${key} ${year} (${arabic})`);
  // 'Day 12 of Ramadan 1447 (رمضان)'
  console.log(`Window: ${span.start.format('{yyyy}-{mm}-{dd}')} → ${span.end.format('{yyyy}-{mm}-{dd}')}`);
  // 'Window: 2026-02-18 → 2026-03-20'
  console.log(`Progress: ${Math.round(span.progress * 100)}%`);
  // 'Progress: 38%'
}
console.log('Sacred month?', isSacred); // false

5. Hebrew Leap-Year Event & Calendar Scheduling (HebrewTerm) ​

The Challenge ​

Community portals, kosher-certification trackers, and Jewish holiday calendars must distinguish Adar I (M05L) from Adar II (M06) in 13-month Metonic leap years (e.g. 5784), where Purim and annual memorials fall in Adar II rather than Adar I.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { HebrewTerm } from '@tempo-kit/plugin-cultural/hebrew';

Tempo.use(HebrewTerm);

function describeAdar(t: Tempo): string {
  const { key, year, isLeapYear, hebrew } = t.term.hebrewMonth;
  return `${key} ${year} (${hebrew}) — ${isLeapYear ? '13-month leap year' : '12-month common year'}`;
}

console.log(describeAdar(new Tempo('2024-02-15T12:00:00Z')));
// 'Adar I 5784 (אדר א׳) — 13-month leap year'

console.log(describeAdar(new Tempo('2024-03-15T12:00:00Z')));
// 'Adar II 5784 (אדר ב׳) — 13-month leap year'

console.log(describeAdar(new Tempo('2025-03-05T12:00:00Z')));
// 'Adar 5785 (אדר) — 12-month common year'

6. East Asian Solar Terms, Liturgical Theming & Rent Quarter Days ​

The Challenge ​

Seasonal retail, agricultural schedules, church/parish portals, UK/Scottish property lease engines, and demographic analytics each rely on domain-specific calendar boundaries that shift annually or follow historical legal conventions.

Implementation Pattern ​

typescript
import { Tempo } from 'tempo-kit';
import { JieqiTerm } from '@tempo-kit/plugin-cultural/jieqi';
import { LiturgicalTerm } from '@tempo-kit/plugin-cultural/liturgical';
import { QuarterDaysTerm } from '@tempo-kit/plugin-cultural/quarter-days';
import { GenerationTerm } from '@tempo-kit/plugin-cultural/generation';

Tempo.use([JieqiTerm, LiturgicalTerm, QuarterDaysTerm, GenerationTerm]);

const t = new Tempo('2026-04-05T12:00:00Z');

// 24 Solar Terms (Qingming festival window)
console.log(t.term.jieqi, t.term.solarTerm.variants.cn.name); // 'Qingming 清明'

// Liturgical UI accent color & Sunday lectionary cycle
console.log(t.term.liturgy, t.term.liturgical.color, t.term.liturgical.liturgicalYear);
// 'Eastertide white A'

// English rent quarter-day window (Lady Day Mar 25 -> Midsummer Jun 24)
console.log(t.term.qday, t.term.quarterDay.span.end.format('{yyyy}-{mm}-{dd}'));
// 'Lady Day 2026-06-24'

// Demographic cohort segmentation
console.log(new Tempo('1990-06-01T00:00:00Z').term.gen); // 'Millennial'
console.log(t.term.gen, t.term.generation.span.end);     // 'Gen Beta' null

Released under the MIT License.