# |
May 31st 2016, 01:08 |
flashios09 |
and if you want another format you have to create two methods |
# |
May 31st 2016, 01:07 |
royalty |
I wish I could use that on all fields that are not created or modified and datetime fields automatically |
# |
May 31st 2016, 01:07 |
flashios09 |
if you have 3 or 4 date fields, you have to create two methods foreach one |
# |
May 31st 2016, 01:06 |
royalty |
I think I will just leave that there |
# |
May 31st 2016, 01:06 |
royalty |
for me the setter in the entity is working |
# |
May 31st 2016, 01:06 |
royalty |
I see |
# |
May 31st 2016, 01:06 |
flashios09 |
when i submit the form i will get the input:hidden value (sql format) |
# |
May 31st 2016, 01:05 |
flashios09 |
after the input text that display the nice format |
# |
May 31st 2016, 01:05 |
flashios09 |
i add a hidden input with date/time/datetime sql format |
# |
May 31st 2016, 01:04 |
flashios09 |
what i do with datepicker |
# |
May 31st 2016, 01:04 |
royalty |
sure, i'll try that |
# |
May 31st 2016, 01:04 |
royalty |
hmmm |
# |
May 31st 2016, 01:02 |
flashios09 |
2- parse it manually using Cake\I18n\Time::parse method |
# |
May 31st 2016, 01:01 |
flashios09 |
1- if you will patch/new the entity, this will parse and re-convert it to date object |
# |
May 31st 2016, 01:01 |
flashios09 |
you have too choice |
# |
May 31st 2016, 01:01 |
flashios09 |
and get the request data then |
# |
May 31st 2016, 01:00 |
flashios09 |
when you submit the form |
# |
May 31st 2016, 01:00 |
flashios09 |
just use i18nFormat() |
# |
May 31st 2016, 01:00 |
flashios09 |
in the view when you need convert the var to any format |
# |
May 31st 2016, 00:59 |
flashios09 |
always set the date as object to the view layer |
# |
May 31st 2016, 00:59 |
royalty |
brb |
# |
May 31st 2016, 00:59 |
royalty |
I was messing with the form input templates |
# |
May 31st 2016, 00:59 |
royalty |
i kind of got it but failed at it at the same time, were you able to do it? |
# |
May 31st 2016, 00:59 |
royalty |
I was trying to make cake automagically create datepickers for all date time field |
# |
May 31st 2016, 00:58 |
royalty |
hmmm |
# |
May 31st 2016, 00:58 |
flashios09 |
yes |
# |
May 31st 2016, 00:58 |
royalty |
you do it in the view? |
# |
May 31st 2016, 00:58 |
flashios09 |
inside a controller/model |
# |
May 31st 2016, 00:57 |
royalty |
I thought my code should do it... https://gist.github.com/Modicrumb/b2552300ffe8c67ee63f4ab6512dd491 |
# |
May 31st 2016, 00:57 |
flashios09 |
``` $date_var->i18nFormat('...'); // any format you want to use ``` |
# |
May 31st 2016, 00:57 |
flashios09 |
from object to string(inside the view layer) |
# |
May 31st 2016, 00:56 |
flashios09 |
i have a datepicker too |
# |
May 31st 2016, 00:56 |
flashios09 |
use a method that convert the date to a string |
# |
May 31st 2016, 00:56 |
royalty |
on the edit action |
# |
May 31st 2016, 00:55 |
royalty |
because I am using a datetime picker field instead of the default selects and i want it to populate the field |
# |
May 31st 2016, 00:55 |
royalty |
it keeps returning an object however |
# |
May 31st 2016, 00:55 |
flashios09 |
why ? |
# |
May 31st 2016, 00:54 |
royalty |
i am trying to change this via the getter method in the entity |
# |
May 31st 2016, 00:54 |
royalty |
instead of a date object |
# |
May 31st 2016, 00:54 |
royalty |
suppose i want cakephp to return a string |
# |
May 30th 2016, 23:12 |
LckyBy517 |
doh |