add date string converter
This commit is contained in:
parent
dcbd5015d2
commit
0411c0a431
1 changed files with 17 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue