blind-date
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,4 +0,1 @@ | ||
import type { DateTime } from 'luxon'; | ||
import type { Moment } from 'moment'; | ||
import type { Dayjs } from 'dayjs'; | ||
declare type Opaque<K, T> = T & { | ||
@@ -12,2 +9,20 @@ __TYPE__: K; | ||
export declare type OffsetDateTimeString = Opaque<'OffsetDateTimeString', string>; | ||
/** | ||
* A type that looks like a Moment of Dayjs, so we don't need to import or, more | ||
* particularly, export Moment or Dayjs types. | ||
*/ | ||
export interface MomentOrDayjsLike { | ||
isValid(): boolean; | ||
toDate(): Date; | ||
utcOffset(): number; | ||
} | ||
/** | ||
* A type that looks like a Luxon DateTime, so we don't need to import or, more | ||
* particularly, export Luxon types. | ||
*/ | ||
export interface DateTimeLike { | ||
offset: number; | ||
toISO(): string; | ||
toMillis(): number; | ||
} | ||
export declare function isLocalDateTimeString(date: unknown): date is LocalDateTimeString; | ||
@@ -17,3 +32,3 @@ export declare function isLocalDateString(date: unknown): date is LocalDateString; | ||
export declare function isOffsetDateTimeString(date: unknown): date is LocalDateString; | ||
export declare type DateLike = string | Moment | Dayjs | DateTime | Date; | ||
export declare type DateLike = string | MomentOrDayjsLike | DateTimeLike | Date; | ||
export declare function toLocalDateTimeString(date: DateLike): LocalDateTimeString; | ||
@@ -20,0 +35,0 @@ export declare function toLocalDateString(date: DateLike): LocalDateString; |
@@ -34,5 +34,4 @@ "use strict"; | ||
var anyDate = date; | ||
return (typeof anyDate.day === 'number' && | ||
typeof anyDate.daysInMonth === 'number' && | ||
typeof anyDate.zoneName === 'string' && | ||
return (typeof anyDate.offset === 'number' && | ||
typeof anyDate.toMillis === 'function' && | ||
typeof anyDate.toISO === 'function'); | ||
@@ -43,3 +42,3 @@ } | ||
if (typeof anyDate.isValid === 'function' && | ||
typeof anyDate.toISOString === 'function' && | ||
typeof anyDate.toDate === 'function' && | ||
typeof anyDate.utcOffset === 'function') { | ||
@@ -46,0 +45,0 @@ return true; |
{ | ||
"name": "blind-date", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
16139
248