export type DateTuple = [number, number, number]; export function datetuple(d: number): DateTuple { return [d / 12 / 30 | 0, (d / 30 | 0) % 12, d % 30] } export function datefmt(d: number): string { return datetuple(d).map(n => n + 1).join("/"); } export function datefrom(y: number, m: number, d: number) { return (y - 1) * 12 * 30 + (m - 1) * 30 + (d - 1); }