@terminus/ngx-tools
Version:
[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github
23 lines (22 loc) • 781 B
TypeScript
/**
* Coerces a data-bound value (typically a string) to a date.
*
* @param value - The value to coerce to a Date
* @param fallbackValue - The value to fall back to if the passed in value is not a valid date
* @returns A Date object
*
* @example
* coerceDateProperty('Wed, 21 Oct 2015 07:28:00 GMT'); // Returns: Date object
* // Also supports a custom fallback value:
* coerceDateProperty<boolean>('foo', false); // Returns: false
*/
export declare function coerceDateProperty(value: any): Date;
export declare function coerceDateProperty<D>(value: any, fallbackValue: D): Date | D;
/**
* Whether the provided value is considered a date.
*
* @private
* @param value
* @returns Boolean
*/
export declare const isDateValue: (value: any) => value is Date;