add deadline to list

This commit is contained in:
Peter Maquiran
2023-04-12 09:01:03 +01:00
parent 3607a34ed3
commit 8cc4181c41
21 changed files with 139 additions and 15 deletions
+24
View File
@@ -0,0 +1,24 @@
import { Injectable } from '@angular/core';
import { momentG } from 'src/plugin/momentG';
@Injectable({
providedIn: 'root'
})
export class TaskService {
constructor() { }
deadlineIsToday(isoDateString:string) {
return momentG(new Date(), 'dd MMMM yyyy') == momentG(new Date(isoDateString), 'dd MMMM yyyy')
}
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()
}
}