1283 Posts
Bucklash
6 years ago
4
Topic

Hi folks

I have ABSOLUTELY no idea on how to do this.

Even though there are some forum posts, it is as clear as mud for me

I have a calendar field: scheduled_time.

It is format: Y-m-d H:i:s

It is storage: Standard | Article | scheduled_time || Datetime

So in my List and Search Type....

I want to filter articles where scheduled time is either after today, or before today.

This requires 2 calendar fields with storage set to scheduled_time.

The Match setting will be either "Past", or "Future".

Using a select simple field, the User then selects "Before Today" or "After today".

And this is meant to fill the appropriate field with the date ie now or -1 day, +1 day

So that is the concept.

Putting it in to action is where it all breaks down for me.

Get a VIP membership
1283 Posts
Bucklash
6 years ago
0
Level 1

For the user to filter based on before or after today I have a select field:

Before Today=-1 day

After Today=+1 day

Using conditionals, if user selects 'Before Today' then my date field where match = Past is filled by -1 day

Using conditionals, if user selects 'After Today' then my date field where match = Future is filled by +1 day

I also enable them based on the same conditions.

So then I search and then not a lot....

1283 Posts
Bucklash
6 years ago
0
Level 1

No matter what I try I still end up with both fields in my query:

...

AND t3.sheduled_time <= '2017-12-18 19:16:16'
AND t3.scheduled_time >= '2017-12-19 03:19:18' 

The calendar fields get disabled correctly, hidden correctly, filled correctly (i.e. -1 day, +1 day).

So what could I be missing?

And why could the times be different in both calendar fields have default value set to now i.e.:

AND t3.sheduled_time <= '2017-12-17 04:13:39'
AND t3.scheduled_time >= '2017-12-21 03:19:18' 

And also.....

The before and after fields both have same settings, exactly, except for the "3 Match and stage" which is past or future.

If user selects "future" then I do not get error nessage.

If user selects past then I get an:

You either used wrong format or locale set by language file is not supported on your server - en_GB.utf8
4229 Posts
Kadministrator
6 years ago
1
Level 1

Calendar field uses hidden fields behind the scenes to post real values, you will probably need to set your conditionals on those fields (or both).

1283 Posts
Bucklash
6 years ago
0
Level 2

Hi Klas

Yeah I noticed that, but none of the pother forum posts mention it as necessary to amend.

Will play around with it and post back a tut when ready to

Get a VIP membership