-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.js
43 lines (38 loc) · 1.1 KB
/
update.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Status
* Models status updates added by users to recount their daily tasks.
* Provides information about the date it was made, the person who made
* the update, as well as the text of the actual update.
*/
var Status = function(date, author, text){
//go ahead and assign it to the current date.
this.date = new Date();
this.author = author;
this.text = text;
//generate a sprint ID +1 of the previous one;
//guaranteed unique for each new created sprint
this.sprintID = sprintID++;
}
/* get the date of the status */
Status.prototype.getDate = function(){
if (this.date.getDate() == new Date().getDate()){
//if the date was from today, just return the HH:mm:am/pm
return this.date.toLocaleTimeString();
}
else{
//return the actual date in
return this.date.toLocaleDateString();
}
}
/* Editing a user's status*/
Status.prototype.setStatus = function(text){
//update the text to new text
this.text = text;
//update the date to a new time
this.date = new Date();
}
Status.prototype.getAuthor = function(){
return this.author;
}
Status.prototype.getText = function(){
return this.text;
}