Created
November 27, 2018 23:17
-
-
Save hieunc229/1f9902a603885eee49d501dcebee7594 to your computer and use it in GitHub Desktop.
Demonstrate filter records by date between start and end date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example 'TodoItems' schema with 'dueDate' using 'datetime' | |
var db = new Vasern({ schema: { | |
name: "TodoItems", | |
props: { | |
name: "string", | |
dueDate: "datetime" | |
} | |
}}); | |
// Sample start and end datetime object | |
var startDate = new Date("2018-11-01"); | |
var endDate = new Date("2018-12-01"); | |
// Get 'TodoItem' which has 'dueDate' between 'startDate' and 'endDate' | |
var matchItems = Vasern.TodoItems.filter(item => { | |
return (item.dueDate > startDate && item.dueDate < endDate); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment