diff --git a/scripts/response/activity.JS b/scripts/response/activity.JS index 86dbb8f..bb5e349 100644 --- a/scripts/response/activity.JS +++ b/scripts/response/activity.JS @@ -7,13 +7,29 @@ class Activity extends DBParser { @param {Object} ENTRY the selected entry, or the entries */ constructor(ENTRY) { - super(DATA, { + super(ENTRY, { "_id": "ID", "username": "username", "description": "description", "duration": "duration", "date": "date" }); + + this.convert_date(); + }; + + /* + Convert the date to the needed format. + + @param {Date} DATE the target date + @return {String} the date + */ + convert_date(DATE) { + if (DATE || this.data.date) { + this.date = (new Date(DATE || this.data.date)).toDateString(); + + return (this.date); + } } }