How to filter with specific date (ex. specific_date is Oct 09 2016 without time) in DB?
const result = realm.objects(type).filtered('DATE == $0', specific_date );
Mon Oct 10 2016 09:37:28 GMT+0800 (SGT)
Sun Oct 09 2016 09:37:28 GMT+0800 (SGT)
Sat Oct 08 2016 09:37:28 GMT+0800 (SGT)
You would want to compare against a range, matching dates at 12am of the day you want and 12am of the next day:
const result = realm.objects(type).filtered('DATE >= $0 && DATE < $1', specific_day, next_day);
Thanks :)
Is realm possible to get strings such as "Mon" from date type?
Thanks @alazier
import { startOfDay, endOfDay } from 'date-fns';
const filterItems = taskLists.filtered('dueDate >= $0 && dueDate <= $1', startOfDay(new Date()), endOfDay(new Date()));
Most helpful comment
You would want to compare against a range, matching dates at 12am of the day you want and 12am of the next day: