devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
117 lines (111 loc) • 3.61 kB
JavaScript
/**
* DevExtreme (cjs/__internal/scheduler/m_date_adapter.js)
* Version: 23.2.6
* Build date: Wed May 01 2024
*
* Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _date = _interopRequireDefault(require("../../core/utils/date"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) {
descriptor.writable = true
}
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor)
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) {
_defineProperties(Constructor.prototype, protoProps)
}
if (staticProps) {
_defineProperties(Constructor, staticProps)
}
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return "symbol" === typeof key ? key : String(key)
}
function _toPrimitive(input, hint) {
if ("object" !== typeof input || null === input) {
return input
}
var prim = input[Symbol.toPrimitive];
if (void 0 !== prim) {
var res = prim.call(input, hint || "default");
if ("object" !== typeof res) {
return res
}
throw new TypeError("@@toPrimitive must return a primitive value.")
}
return ("string" === hint ? String : Number)(input)
}
const toMs = _date.default.dateToMilliseconds;
let DateAdapterCore = function() {
function DateAdapterCore(source) {
this._source = new Date(source.getTime ? source.getTime() : source)
}
var _proto = DateAdapterCore.prototype;
_proto.result = function() {
return this._source
};
_proto.getTimezoneOffset = function() {
let format = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0;
const value = this._source.getTimezoneOffset();
if ("minute" === format) {
return value * toMs("minute")
}
return value
};
_proto.getTime = function() {
return this._source.getTime()
};
_proto.setTime = function(value) {
this._source.setTime(value);
return this
};
_proto.addTime = function(value) {
this._source.setTime(this._source.getTime() + value);
return this
};
_proto.setMinutes = function(value) {
this._source.setMinutes(value);
return this
};
_proto.addMinutes = function(value) {
this._source.setMinutes(this._source.getMinutes() + value);
return this
};
_proto.subtractMinutes = function(value) {
this._source.setMinutes(this._source.getMinutes() - value);
return this
};
_createClass(DateAdapterCore, [{
key: "source",
get: function() {
return this._source
}
}]);
return DateAdapterCore
}();
const DateAdapter = date => new DateAdapterCore(date);
var _default = DateAdapter;
exports.default = _default;