Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created May 31, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lydemann/af97856acf5533ace0867ee727350d59 to your computer and use it in GitHub Desktop.
Save lydemann/af97856acf5533ace0867ee727350d59 to your computer and use it in GitHub Desktop.
todo-list.component.ts
public duedateTodayCount$ = this.todoList$.pipe(
map((todoList) => todoList.filter((todoItem) => this.isToday(todoItem.dueDate)).length)
);
private isToday(someDate) {
const today = new Date();
return (
someDate.getDate() === today.getDate() &&
someDate.getMonth() === today.getMonth() &&
someDate.getFullYear() === today.getFullYear()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment