Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative dates like today aren't parsed #1417

Closed
bobdenotter opened this issue May 28, 2020 · 1 comment · Fixed by #1418 or #1744
Closed

Relative dates like today aren't parsed #1417

bobdenotter opened this issue May 28, 2020 · 1 comment · Fixed by #1418 or #1744
Assignees
Labels
🐛 tag: bug This is a bug.

Comments

@bobdenotter
Copy link
Member

bobdenotter commented May 28, 2020

For example {% setcontent agenda = 'agenda' limit 4 where { enddate: '>today' } printquery %} gives:

WHERE content.contentType = :ct0 AND content.status = :status_1 AND (content.id IN(SELECT content_3.id FROM Bolt\Entity\Content content_3 
INNER JOIN content_3.fields fields_3 
INNER JOIN fields_3.translations translations_3 
WHERE JSON_EXTRACT(translations_3.value, '$[0]') > :enddate_1 AND fields_3.name = :field_3)) 
ORDER BY content.publishedAt DESC

  - ct0: agenda
  - enddate_1: today
  - status_1: published
  - field_3: enddate

The - enddate_1: today should hold a date, and not the literal string "today"

@peterboorsma
Copy link
Contributor

Reopening this. I don't think this is solved (sorry)

My date field in contenttype.yaml:

        date_to:
            type: date
            default: "first day of this month"

My query:
{% setcontent agenda = 'agenda' where { date_to: '>today' } limit 30 orderby 'date_to' printquery %}

My output:

 SELECT content FROM Bolt\Entity\Content content LEFT JOIN content.fields fields_order_3 LEFT JOIN fields_order_3.translations translations_order_3 WHERE content.contentType = :ct0 AND content.status = :status_1 AND (content.id IN(SELECT content_3.id FROM Bolt\Entity\Content content_3 INNER JOIN content_3.fields fields_3 INNER JOIN fields_3.translations translations_3 WHERE (JSON_EXTRACT(LOWER(translations_3.value), '$[0]') > :date_to_1 OR LOWER(translations_3.value) LIKE :date_to_1_JSON) AND fields_3.name = :field_3)) AND fields_order_3.name = :order_3 AND translations_order_3.locale = :order_3_locale ORDER BY lower(translations_order_3.value) ASC

    ct0: agenda
    date_to_1: today
    status_1: published
    field_3: date_to
    date_to_1_JSON: %"today"%
    order_3_locale: nl
    order_3: date_to


Bolt 4.0.0 RC35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 tag: bug This is a bug.
Projects
None yet
3 participants