Question: Filter by date.

Open
#962 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
15/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
sqlite, swift
Domain
database

Research direction

Start with the Date/Time Values section in Documentation/Index.md and compare it with the reported Swift filter and generated SQL. Reproduce the query against SQLite.swift if possible; done should be a confirmed explanation or a clearly scoped fix, but the issue currently does not identify a target file or test.

Written by the indexing model from the issue text.

Description

bug question

Hi there,
I just wanna filter all dates that older than 24 hours.
I was trying to do it like this https://github.com/stephencelis/SQLite.swift/blob/master/Documentation/Index.md#date-time-values
But it doesn't work for me :(

E.g:

let table = self.table
let boundDate = Date(timeInterval: -86400, since: Date())
let query = table.filter(self.date <= boundDate )
print(query.asSQL())

As a result I get zero items.
My SQL query logs print next

SELECT * FROM "logs" WHERE ("date" <= '2019-10-15T18:54:18.109')

What I'm doing wrong?

Dominant language
Swift
Stars
10.2k
Forks
1.6k
Avg merge
6d 2h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stephencelis/SQLite.swift

All issues in stephencelis/SQLite.swift

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.