UNPKG

@csvw-rdf-convertor/core

Version:

This library was generated with [Nx](https://nx.dev).

33 lines (32 loc) 940 B
import { format } from 'date-fns'; export function formatDate(dateStr, formatStr) { formatStr = formatStr.replace(/T/g, "'T'"); const date = new Date(dateStr); return format(date, formatStr).toString(); } export function isDateFormatedColumn(column) { if (column === undefined) { return false; } if (column.datatype) { const dataType = column.datatype; if (dataType.base === 'datetime' || dataType.base === 'date') { if (dataType.format) { return true; } } } return false; } export function convertColumnToDateFormattedColumn(column) { if (column.datatype) { const dataType = column.datatype; if (dataType.base === 'datetime' || dataType.base === 'date') { if (dataType.format) { return column; } } } return null; } //# sourceMappingURL=date-formatting.js.map