export class TodoItem { public readonly id : number ; public readonly createdOn : number ; public completedOn : number ; public title : string ; public finished : boolean ; constructor ( _title ) { this . title = _title ; this . id = Math . random ( ) ; this . createdOn = new Date ( ) . getTime ( ) ; } public setFinished ( isFinished ) { this . finished = isFinished ; this . completedOn = this . finished ? new Date ( ) . getTime ( ) : undefined ; } }