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

3.0 Date field invalid date and black-holed in forms #3573

Closed
rafrsr opened this issue May 26, 2014 · 2 comments
Closed

3.0 Date field invalid date and black-holed in forms #3573

rafrsr opened this issue May 26, 2014 · 2 comments
Milestone

Comments

@rafrsr
Copy link

rafrsr commented May 26, 2014

I have a list and form, in both case I render the value of date field as is, I expect the date field only render the date, but I got the date and time, the hour is not saved in DB because the field is type date.

echo $entity->date

Expected: 05/26/2014
Result: 05/26/2014 5:13 PM

In the form I'm using a text input for the date, in order to use jquery datepicker instead of three inputs. Using cake default inputs the inputs are ok without time.

Another related problem , if I use the cake default inputs, for day, month and year then the submit is black-holed

@markstory markstory added this to the 3.0.0 milestone May 26, 2014
@markstory
Copy link
Member

This happens because CakePHP maps all date, datetime, and timestamp columns to native PHP Datetime objects which always have a time component. It might be possible to have the ORM use a different object, or indicate to the created object that it should not format the time segments.

Another related problem , if I use the cake default inputs, for day, month and year then the submit is black-holed.

I'll look into this as that should not be happening.

@markstory markstory added Defect and removed helpers labels May 26, 2014
@lorenzo
Copy link
Member

lorenzo commented May 26, 2014

I don't think it would be crazy to have a Date object to represent date columns. The object would inherit from Time and would override the display functions to avoid this problem. I consider this just an annoyance and not a real problem, so it will be down in my priority list. If anyone wats to take stab on it, please do :)

markstory added a commit that referenced this issue May 27, 2014
Ensure all the various datetime fields are added to Form->fields so they
are not blackholed later.

Fixes #3573
@lorenzo lorenzo closed this as completed May 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants