No we’re not talking about romantic dating. I’m talking about adding due dates to goals to make them timely or time-bound.
Let’s say we have a goal like this:
const myGoal = {
action: 'Eat',
quantity: 3,
measurement: 'slices of pizza'
}
It’s actionable, measurable, but lacks a time or due date. Let’s add one using a Date object.
const myGoal = {
action: 'Eat',
quantity: 3,
measurement: 'slices of pizza',
dueDate: new Date(2021, 11, 31) // YYYY, MM, DD
}
What I’ve done now is set a dueDate property to the end of 2021. If you’ve got a good eye, you noticed that I put 11 for the month instead of 12. However, the month index for the Date object is zero-indexed, meaning that 0 instead of 1 represents the first month of the year.