This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2023-03-11 18:20:07 +00:00
|
|
|
import AbstractModel from './abstractModel'
|
|
|
|
import type {ITaskReminder} from '@/modelTypes/ITaskReminder'
|
|
|
|
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
|
|
|
import type {IReminderPeriodRelativeTo} from '@/types/IReminderPeriodRelativeTo'
|
|
|
|
|
|
|
|
export default class TaskReminderModel extends AbstractModel<ITaskReminder> implements ITaskReminder {
|
|
|
|
reminder: Date | null
|
2023-03-16 08:54:18 +00:00
|
|
|
relativePeriod = 0
|
2023-03-11 18:20:07 +00:00
|
|
|
relativeTo: IReminderPeriodRelativeTo | null = null
|
|
|
|
|
|
|
|
constructor(data: Partial<ITaskReminder> = {}) {
|
|
|
|
super()
|
|
|
|
this.assignData(data)
|
|
|
|
this.reminder = parseDateOrNull(data.reminder)
|
2023-06-10 16:54:39 +00:00
|
|
|
if (this.relativeTo === '') {
|
|
|
|
this.relativeTo = null
|
|
|
|
}
|
2023-03-11 18:20:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|