MCPcopy Index your code
hub / github.com/tinyplex/tinybase / normalizeTimeValue

Function normalizeTimeValue

src/ui-react-dom-charts/common/data.ts:267–281  ·  view source on GitHub ↗
(
  value: unknown,
  timestampUnit: TimestampUnit,
)

Source from the content-addressed store, hash-verified

265};
266
267export const normalizeTimeValue = (
268 value: unknown,
269 timestampUnit: TimestampUnit,
270): number | undefined => {
271 const timestamp = isNumber(value)
272 ? timestampUnit == SECOND_UNIT
273 ? value * 1000
274 : value
275 : isString(value) && ISO_DATE.test(value)
276 ? getTime(value)
277 : value instanceof Date
278 ? getTime(value)
279 : undefined;
280 return isFiniteNumber(timestamp) ? timestamp : undefined;
281};
282
283export const getTickBounds = (
284 [xMin, xMax, yMin, yMax]: Bounds,

Callers 6

getAxisBoundFunction · 0.90
getAxisTicksFunction · 0.90
getTickLabelFunction · 0.90
getResolvedXScaleFunction · 0.70
getXScaleDomainFunction · 0.70
getContinuousXValueFunction · 0.70

Calls 3

isNumberFunction · 0.90
isStringFunction · 0.90
getTimeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…