webhandle-calendar
Version:
Calendar tools for node webhandle
33 lines (27 loc) • 487 B
JavaScript
// const _ = require('underscore')
/*
* Properties:
*
* title: (string)
* desc: (string)
* start: (date)
* end: (date)
*/
class Event {
constructor(options) {
Object.assign(this, options)
if(!this.start) {
this.start = new Date()
}
if(!this.end) {
this.end = new Date()
}
if(typeof this.start === 'string') {
this.start = new Date(this.start)
}
if(typeof this.end === 'string') {
this.end = new Date(this.end)
}
}
}
module.exports = Event