move filter function out, add more tests on datetime getter