@wordpress/components
Version:
UI components for WordPress.
19 lines (17 loc) • 370 B
JavaScript
/**
* External dependencies
*/
import { toDate } from 'date-fns';
/**
* Like date-fn's toDate, but tries to guess the format when a string is
* given.
*
* @param input Value to turn into a date.
*/
export function inputToDate(input) {
if (typeof input === 'string') {
return new Date(input);
}
return toDate(input);
}
//# sourceMappingURL=utils.js.map