contao/calendar-bundle

Make the end-time selection empty if not used

Closed this issue ยท 8 comments

mpitz commented

While you can leave the end-date empty you have to set a end-time to leave it open. This is confusing and not consequent. I suggest to leave the end-time empty too if it is not used!

image

If you change the start-time you every time have to set the end-time again if you want to leave it open!

I doubt that this is possible, because tl_calendar_events.endTime cannot be empty.

Aybee commented

Why can this not be empty? Can't you check: if empty than equal starttime, if you need it within your logic?

It's because tl_calendar.startTime and tl_calendar.endTime are the two main fields that store the calculated start and end time (e.g. see here). And the end time cannot be null.

Aybee commented

And the end time cannot be null.

As your query does not work with NULL?

@mpitz I've this in my dcaconfig

/** Events */
// Set endtime default to empty
$GLOBALS['TL_DCA']['tl_calendar_events']['fields']['endTime']['default'] = NULL;

With this setting, the End time is not set automatically when you activate Add time. So you can change the automatically set Start time and if you leave the field End time empty it gets filled with your Start time when you save the event.

BTW, why gets the Start time filled with the current time? I think this will not happen, that we want the Start time to be the current time.

So you can change the automatically set Start time and if you leave the field End time empty it gets filled with your Start time when you save the event.

But that's not what @mpitz wants. He wants the field to remain blank for open end events.

mpitz commented

But that's not what @mpitz wants. He wants the field to remain blank for open end even

Right, that's not what I suggested. It is annoying and error prone if you have the set the End time again if you want to leave it open, after you've changed the Start time.

Implemented in 5629a7d. It was surprisingly simple. ๐Ÿ˜„

Aybee commented

Wow. Thank you. ๐Ÿ‘ ๐Ÿฅ‡ ๐Ÿ’ฏ