# |
Jun 17th 2019, 00:09 |
graziel |
different error or same? |
# |
Jun 17th 2019, 00:09 |
swimboy |
Still no go |
# |
Jun 17th 2019, 00:08 |
graziel |
maybe i have older code but it should work |
# |
Jun 17th 2019, 00:08 |
graziel |
Add a localized time, date or datetime format validation rule to a field. |
# |
Jun 17th 2019, 00:07 |
swimboy |
Shoud that be `$validator->localizedDate('date', 'date');` |
# |
Jun 17th 2019, 00:06 |
graziel |
$validator->localizedTime('date', 'date'); |
# |
Jun 17th 2019, 00:06 |
graziel |
there is different validator for localized format |
# |
Jun 17th 2019, 00:06 |
swimboy |
Yes, I get a validation error |
# |
Jun 17th 2019, 00:05 |
graziel |
you get validation error? |
# |
Jun 17th 2019, 00:05 |
graziel |
but what do you mean accept format? |
# |
Jun 17th 2019, 00:05 |
swimboy |
Nope, that doesn’t work either. Still only accepts it in “2019-06-16” format |
# |
Jun 17th 2019, 00:04 |
graziel |
try ->setLocaleFormat('MM/dd/yyyy') |
# |
Jun 17th 2019, 00:03 |
swimboy |
It’s frustrating. I know I have it working in one app I built two years ago, but I can’t figure out what I did. |
# |
Jun 17th 2019, 00:02 |
graziel |
well you could write your own data type and set it manually in table |
# |
Jun 17th 2019, 00:02 |
swimboy |
I dug through my old code, and the last time I just threw up my hands and wrote a function to change the format manually after submitting my form. It was a PITA because I had to call it every time I used a date in a form. |
# |
Jun 17th 2019, 00:01 |
graziel |
something silly |
# |
Jun 17th 2019, 00:01 |
graziel |
hm i remember i had something simmilar issue but i cant remember what it was |
# |
Jun 16th 2019, 23:59 |
swimboy |
Besides, no matter what I change, the only format that gets accepted is “2019-06-16” |
# |
Jun 16th 2019, 23:57 |
swimboy |
It says it uses icu |
# |
Jun 16th 2019, 23:54 |
graziel |
i cant remember which format it takes icu or iso :S |
# |
Jun 16th 2019, 23:53 |
swimboy |
Still doesn’t work with ```Type::build('date') ->useImmutable() ->useLocaleParser() ->setLocaleFormat('M/dd/y');``` |
# |
Jun 16th 2019, 23:51 |
graziel |
try forcing your format with ->setLocaleFormat |
# |
Jun 16th 2019, 23:51 |
swimboy |
I have it like this: ```Type::build('date') ->useImmutable() ->useLocaleParser();``` |
# |
Jun 16th 2019, 23:50 |
swimboy |
I also have `Type::build('date')->useLocaleParser();` in my bootstrap |
# |
Jun 16th 2019, 23:50 |
graziel |
so you need Type::build('date') not datetime |
# |
Jun 16th 2019, 23:49 |
swimboy |
date |
# |
Jun 16th 2019, 23:49 |
graziel |
or time or date? |
# |
Jun 16th 2019, 23:49 |
graziel |
and you have datetime type in database? |
# |
Jun 16th 2019, 23:28 |
swimboy |
Still running into problems. I tried putting `Type::build('datetime')->useLocaleParser();` in my controller, and in the bootstrap.php (where the other Type::build settings are), but neither had any effect. |
# |
Jun 16th 2019, 23:17 |
graziel |
: ) |
# |
Jun 16th 2019, 23:16 |
swimboy |
Thanks! |
# |
Jun 16th 2019, 23:15 |
graziel |
https://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data |
# |
Jun 16th 2019, 23:12 |
slackebot1 |
“2019-06-16” in the field, it accepts the value. |
# |
Jun 16th 2019, 23:12 |
swimboy |
I know I solved this once in an older version of CakePHP, but a) I don’t remember how I did it, and b) I think it’s handled differently now. My default locale is set to “en-US” in config/app.php and my dates are displaying as “6/16/2019" as I expect; but I’m using a plain text field instead of the default three menus for input forms, and trying to save a record in the same format gets rejected as being invalid. If I manually type |
# |
Jun 16th 2019, 22:44 |
joey.mukherjee |
Weird... some how the hydration is messing up. I had to set enableHydration (false) on my query and use it that way. |
# |
Jun 16th 2019, 22:25 |
joey.mukherjee |
I json_encode an array in my beforeSave routine in my table. I see it save correctly into my database as a string. However, when I load it, some of my strings are set to '' or empty. Not all of them though. Any ideas? |
# |
Jun 16th 2019, 20:48 |
stephenzgalbraith |
Trying to get the authentication plugin to work with v4 and getting this error |
# |
Jun 16th 2019, 20:48 |
slackebot1 |
<stephenzgalbraith> |
# |
Jun 16th 2019, 17:20 |
admad |
also you should be using `'controller' => 'Plots'` not `'controller' => '/plots'` |
# |
Jun 16th 2019, 17:19 |
admad |
@joey.mukherjee cause the router adding current plugin to URLs by default. Add `'plugin' => false` to the URL array to prevent that |
# |
Jun 16th 2019, 16:19 |
joey.mukherjee |
Basic question: I am trying to use the CakeDC/Users plugin with v3.7. I have a menubar.ctp as my element being included in my Template/Layout/default.ctp I have a: <a href="<?php echo $this->Url->build (['controller' => '/plots', 'action' => 'index']); ?>">Plots</a> and a <a href="profile">Profile</a>. When I go to the profile page, my Plots link now has a users prepended to it. Why? |