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

Add the ability to use any date for a collection dateRange filter #274

Closed
akoebbe opened this issue Aug 21, 2015 · 4 comments
Closed

Add the ability to use any date for a collection dateRange filter #274

akoebbe opened this issue Aug 21, 2015 · 4 comments

Comments

@akoebbe
Copy link
Contributor

akoebbe commented Aug 21, 2015

I'd like to be able to use an arbitrary date attribute (a custom one) on a page to use as the collection filter for list pages. Right now only the "date" field can be used.

I have an "event" page type that has an event.time (datetime) field that I want to only show upcoming events in a listing page.

@akoebbe
Copy link
Contributor Author

akoebbe commented Aug 21, 2015

From my PR:

This feature allows the user to specify a custom field to use in the dateRange filter of a collection page. While the same thing is most likely possible to using the Publish and Unpublish Date fields on each child page, this removes the chance of errors and extra fields to fill out.

Use case: Display a list of "event" page types that only shows upcoming events.

Yaml usage:

content:
    items: @self.children
    dateRange:
        start: today
        field: header.event.time               // can use anything $page->value() will take

@rhukster
Copy link
Member

Thanks for your PR. merged!

@vitopepito
Copy link

I experienced that when using a custom field for dateRange, it is not properly ordering the items when the european date format is used. For example an items YAML like: header.event.date: 30-03-2017 will somehow be treated as 30/03/2017. Ordering then follows Year -> Month -> Day even if Month = 30 does not exist. Issue does not occur when using default header.date for range.

@akoebbe
Copy link
Contributor Author

akoebbe commented Mar 21, 2017

@vitopepito could you make a new issue for this bug. I'll see if I can dig in to it tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants