@semcore/chart
Version:
Semrush Chart Component
22 lines • 813 B
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
/**
* @deprecated Please, use package `@semcore/ui/d3-chart` instead. Package `@semcore/chart` is deprecated.
*/
export function timeFormat(options) {
var local = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
var defaultOptions = {
month: 'short',
day: 'numeric',
year: 'numeric'
};
if (Array.isArray(options)) {
options = options.reduce(function (opts, name) {
return _objectSpread(_objectSpread({}, opts), {}, _defineProperty({}, name, defaultOptions[name]));
}, {});
}
return function (date) {
return new Intl.DateTimeFormat(local, options).format(date);
};
}
//# sourceMappingURL=timeFormat.js.map