sailfork / diff-demo / src/ util/ money.ts

export type Cents = number;

export const toCents = (dollars: number): Cents => Math.round(dollars * 100);

export const format = (amount: Cents) => `${(amount / 100).toLocaleString('en-US', { minimumFractionDigits: 2 })}`;