awv-api
Version:
31 lines (30 loc) • 964 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var FieldHelper_1 = __importDefault(require("../helper/FieldHelper"));
/**
* Event class
*
* @class Event
*/
var Event = /** @class */ (function () {
function Event(date, label, provider) {
this.date = date;
this.label = label;
this.provider = provider;
if (!this.isValid()) {
throw new Error('Event is not valid!');
}
}
Event.prototype.isValid = function () {
return FieldHelper_1.default.hasNotEmptyStringFields(this, 'date', 'label', 'provider');
};
Event.prototype.getDate = function () {
var splits = this.date.split('.');
return new Date(splits[3] + '-' + splits[1] + '-' + splits[0]);
};
return Event;
}());
exports.default = Event;