# |
May 31st 2016, 01:16 |
flashios09 |
did you try something like this : |
# |
May 31st 2016, 01:14 |
royalty |
and of course i have js stuff to get this going as well |
# |
May 31st 2016, 01:13 |
royalty |
which is kind of dumb, but i just wanted to get something working |
# |
May 31st 2016, 01:13 |
royalty |
the name thing doesn't really work, i have to feed it the name |
# |
May 31st 2016, 01:12 |
royalty |
pretty much the app_form is the datepicker |
# |
May 31st 2016, 01:11 |
royalty |
here you go, heh https://gist.github.com/Modicrumb/397c6a73fd197df162213cbeac6a15ea |
# |
May 31st 2016, 01:09 |
flashios09 |
.ctp that has the datepicker |
# |
May 31st 2016, 01:09 |
royalty |
okay, you mean the view class or the template or both? |
# |
May 31st 2016, 01:08 |
flashios09 |
gist the view file |
# |
May 31st 2016, 01:08 |
royalty |
I only want one format I think, and will update based on locale I suppose |
# |
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) |