centralize service

This commit is contained in:
Peter Maquiran
2023-04-17 16:00:30 +01:00
parent 9c835cde28
commit 955640e42e
8 changed files with 269 additions and 306 deletions
@@ -18,6 +18,9 @@ export class EventoaprovacaoStoreService {
private _counts : {[key: string]: number} = {}
private _countsAll = 0
newList = []
constructor() {
this.keyNameAll = (SHA1("EventoaprovacaoStoreService"+"all")).toString()
@@ -96,9 +99,25 @@ export class EventoaprovacaoStoreService {
this._countsAll = allList.length
this._concatList = allList
this.newList = this._concatList.filter((e) =>{
return this.lessthen24Hours(e.TaskStartDate || e.taskStartDate)
})
}
lessthen24Hours(isoDateString:string) {
const creationDate = new Date(isoDateString)
const creationDatePlus24h = new Date(creationDate)
creationDatePlus24h.setHours((creationDate.getHours() + 24))
const currentDate = new Date()
return creationDatePlus24h.getTime() > currentDate.getTime()
}
}
export const EventoAprovacaoStore = new EventoaprovacaoStoreService()