@digital-magic/io-ts-local-date-time
Version:
LocalDate, LocalTime and TimeSlot types and utilities for TS
43 lines (42 loc) • 1.4 kB
TypeScript
import * as t from 'io-ts';
import { Ord } from 'fp-ts/lib/Ord';
export declare const SecondsTimeSlot: t.TypeC<{
timeSince: t.NumberC;
timeBefore: t.NumberC;
}>;
export declare type SecondsTimeSlot = t.TypeOf<typeof SecondsTimeSlot>;
export declare const TimeSlot: t.TypeC<{
timeSince: t.BrandC<t.StringC, {
readonly LocalTime: symbol;
}>;
timeBefore: t.BrandC<t.StringC, {
readonly LocalTime: symbol;
}>;
}>;
export declare type TimeSlot = t.TypeOf<typeof TimeSlot>;
export declare const SecondsTimeSlotToTimeSlotDecoder: t.Decoder<{
timeSince: t.Branded<string, {
readonly LocalTime: symbol;
}>;
timeBefore: t.Branded<string, {
readonly LocalTime: symbol;
}>;
}, {
timeSince: number;
timeBefore: number;
}>;
export declare const secondsTimeSlotToTimeSlotEncoder: (dateFormat: string) => t.Encoder<SecondsTimeSlot, TimeSlot>;
export declare const secondsTimeSlotToTimeSlot: (value: {
timeSince: t.Branded<string, {
readonly LocalTime: symbol;
}>;
timeBefore: t.Branded<string, {
readonly LocalTime: symbol;
}>;
}) => {
timeSince: number;
timeBefore: number;
};
export declare const timeSlotOrd: Ord<TimeSlot>;
export declare function slotOverlaps(x: SecondsTimeSlot, y: SecondsTimeSlot): boolean;
export declare function hasOverlaps(slots: ReadonlyArray<TimeSlot>): boolean;