Skip to content

Tempo Plugin

@magmacomputing/tempo-plugin-finance ​

npm version npm peer dependency version License TypeScript Ready

A specialized namespace plugin for Tempo that provides fiscal year and financial date utilities.


Key Features ​

  • Namespaced API: All utilities are grouped under t.finance.
  • Fiscal Calendar Properties: Read t.finance.fiscalQuarter and t.finance.taxYear directly from any Tempo instance.
  • Boundary Helpers: t.finance.isFiscalYearStart() flags fiscal year boundaries.

Installation ​

bash
npm install @magmacomputing/tempo-plugin-finance

Quickstart ​

Interactive Demo (@magmacomputing/tempo-plugin-finance)
Open in Full REPL↗
// 💼 Fiscal & Financial Math Demo (@magmacomputing/tempo-plugin-finance)
const { FinanceNamespace } = await import('@magmacomputing/tempo-plugin-finance');
Tempo.use(FinanceNamespace);

const t = new Tempo('2026-07-15');
console.log('Fiscal Quarter:', t.finance.fiscalQuarter);
console.log('Tax Year:', t.finance.taxYear);
console.log('Is Fiscal Year Start?', t.finance.isFiscalYearStart());

return `Fiscal Q${t.finance.fiscalQuarter} (Tax Year ${t.finance.taxYear})`;
Executes 100% in browser via native ESM sandbox
typescript
import { Tempo } from '@magmacomputing/tempo';
import { FinanceNamespace } from '@magmacomputing/tempo-plugin-finance';

// Register the namespace
Tempo.use(FinanceNamespace);

const t = new Tempo('2024-07-01');

// Evaluate static properties
console.log(t.finance.fiscalQuarter); // 3
console.log(t.finance.taxYear); // 2024

// Evaluate functional closures
console.log(t.finance.isFiscalYearStart()); // false

Auto-Installation (Side-Effect Import) ​

For zero-boilerplate global registration, import the /install subpath:

typescript
import { Tempo } from '@magmacomputing/tempo';
import '@magmacomputing/tempo-plugin-finance/install';

const t = new Tempo('2024-07-01');
console.log(t.finance.fiscalQuarter); // 3

License ​

This is a Community plugin. It is completely free and open-source for personal and commercial use under the MIT license.

Released under the MIT License.