MCPcopy Index your code
hub / github.com/microsoft/SandDance / getD3TimeFormat

Function getD3TimeFormat

packages/sanddance/src/date.ts:35–43  ·  view source on GitHub ↗
(min: number, max: number)

Source from the content-addressed store, hash-verified

33const month = year / 12;
34
35function getD3TimeFormat(min: number, max: number) {
36 const span = max - min;
37 if (span > year) return '%Y';
38 if (span > month) return '%b %Y';
39 if (span > day) return '%d %b %y';
40 if (span > hour) return '%d %b %H:%M';
41 if (span > second) return '%H:%M:%S';
42 return '%S.%L';
43}
44
45function vegaTimeFormat(values: [number, number][], d3TimeFormat: string) {
46 const name = 'timeFormat';

Callers 1

makeDateRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected