dateValueOf

Converts an ISO date to the fractional year it plots at, or returns null for anything else.

@internote/canvas-sdkFunction
On this page
import { dateValueOf } from '@internote/canvas-sdk';

Whole numbers rather than epoch days on purpose: a domain of [2020, 2025], a zoom window and a fit's slope all speak plain numbers, and a slope over fractional years means "per year". A day-precision date lands at year + (dayOfYear − 1) / daysInYear, so the first of January is the integer year and year ticks label exactly; a month-precision date lands at year + (month − 1) / 12.

#Signature

(cell: string): number | null

#Parameters

cell
The date as written, 2024-03-15 or 2024-03.

Declared in packages/canvas-sdk/src/data/columns.ts:48.

Last updated