0

我有一个事件的开始和结束的日期时间输入的事件。如果我尝试在上午 11:30 保存 2015 年 12 月 8 日开始,在下午 12:30 保存 2015 年 12 月 8 日结束,则事件将被保存,但日期为 2015 年 12 月 9 日。我不知道它为什么这样做。我尝试添加验证规则,如“datetime”和“notBlank”,但这只会给我错误提示字段无效和/或必需。所以我把验证规则去掉了。有什么建议为什么日期时间的行为如此奇怪?

形式:

<?= $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(); ?>
4

0 回答 0