0

I have events that have a datetime input for the start and end of the event. If I try to save the start 12-8-2015 at 11:30am and the end 12-8-2015 at 12:30pm the event gets save but it makes the date 12-9-2015. I don't know why it is doing this. I have tried adding validation rules like 'datetime', and 'notBlank', but that would just give me errors saying the fields were invalid and/or required. So I took the validation rules out. Any suggestions why the behavior is so weird with datetime?

Form:

<?= $this->Form->create($event, ['type' => 'file']);?>
        <fieldset>
            <legend><?= __('Edit Event'); ?></legend>
        <?php
            echo $this->Form->input('id');
            echo $this->Form->input('event_type_id');
            echo $this->Form->input('event_img', ['type' => 'file']);
            echo $this->Form->input('title');
            echo $this->Form->input('location');
            echo $this->Form->input('details');
            echo $this->Form->input('cost');
            echo $this->Form->label('Start Time');
            echo $this->Form->datetime('start', ['interval' => 15, 'timeFormat' => 12]);
            echo $this->Form->label('End Time');
            echo $this->Form->datetime('end', ['interval' => 15, 'timeFormat' => 12]);
            echo $this->Form->input('all_day');
            echo $this->Form->input('status', ['options' => [
                        'Scheduled' => 'Scheduled','Confirmed' => 'Confirmed','In Progress' => 'In Progress',
                        'Rescheduled' => 'Rescheduled','Completed' => 'Completed'
                        ]
                    ]
                );
        ?>
        </fieldset>
    <?= $this->Form->button(__('Submit', true));?>
    <?= $this->Form->end(); ?>
9
  • Can you add the result of debug($this->request->data) to your question please? What type does the database field for "start" and "end" have? Commented Dec 22, 2015 at 4:05
  • The fields are datetime in the database. Debugging gets me nothing because the event is saved "without" issues. Commented Dec 22, 2015 at 4:28
  • 12:30PM is the next day Commented Dec 22, 2015 at 8:10
  • Use 12:30AM instead of 12:30PM. Or just use 24hr clock and be done with it ;) Commented Dec 22, 2015 at 15:40
  • @ankr Uh what? the event goes from 11:30am to 12:30pm if cake can't handle that don't you think there is a problem? Commented Dec 22, 2015 at 22:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.