tedious
Version:
A TDS driver, for connecting to MS SQLServer databases.
31 lines (30 loc) • 1.28 kB
TypeScript
import type WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';
/**
* The number of days from 1970-01-01 to the given date in the proleptic
* Gregorian calendar. `month` is 1-based.
*
* Uses `setUTCFullYear` rather than `Date.UTC`, because `Date.UTC` maps
* years 0-99 to 1900-1999.
*/
export declare function epochDay(year: number, month: number, day: number): number;
/**
* A `Date` that may carry the sub-millisecond part of a `time`, `datetime2`
* or `datetimeoffset` value, as the value parser produces it.
*/
export interface TemporalValue extends Date {
nanosecondDelta?: number;
}
/**
* The number of days from 0001-01-01 to the calendar date of `value`.
*/
export declare function daysSinceYearOne(value: Date, useUTC: boolean): number;
/**
* The length in bytes of a `time` value at `scale`, as it prefixes the
* value and pads out the lengths of `datetime2` and `datetimeoffset`.
*/
export declare function timeLength(scale: number | undefined): number;
/**
* Writes the time of day of `value` as the number of 10^-scale second
* intervals since midnight, in `timeLength(scale)` bytes.
*/
export declare function writeTimeOfDay(buffer: WritableTrackingBuffer, value: TemporalValue, scale: number, useUTC: boolean): void;