UNPKG

datocms-client

Version:

For new DatoCMS users, we recommend @datocms/cma-client-node

30 lines (21 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = DateOnly; function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /* eslint-disable no-proto */ function DateOnly() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var instance = _construct(Date, args); instance.__proto__ = DateOnly.prototype; return instance; } DateOnly.prototype = Object.create(Date.prototype); DateOnly.prototype.toMap = function toMap() { return this.toISOString().slice(0, 10); };