Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Midnight Modding Posted June 22, 2018 Posted June 22, 2018 I have some Date inputs on my form. Let's call one dateOne. I set time to TRUE. It has time there to select on the form. Yet if I var_dump \IPS\Request::i()->dateOne, it shows it's only a string of the date with no time! No wonder my validation checks are erroring out. What is going on here? But if I var_dimp $val from a current input's date field, it correctly has the time in the DateTime object. The only place I can find an example of IPS comparing times on a form is when they have it all as one input. That would be too messy for my situation, due to 6 times involved.
Midnight Modding Posted June 22, 2018 Author Posted June 22, 2018 Figured it out. var dumped all of request data and see it adds a field with _time such as dateOne_time, in my example. Again editing to try to get to the point quicker... All I am now asking is if anyone has a great idea for how to compare multiple Date inputs from the form other than replicating code from Date.php formatValue(), using that method directly by loading the file, or comparing them all in the $values = $form->values() check. That last option is my iopinion of the best way, where I am not having to do the same code as IPS is already doing... to get request data into DateTime objects over and over. Only problem is then I'll have to put errors at the top of the form instead of by each input. Maybe could at least get $form->error to include all of those errors, though.
Midnight Modding Posted June 25, 2018 Author Posted June 25, 2018 When someone understandably wonders why I am talking about the same thing in 2 topics, this one originally was about a bug in my code, then I got onto this comparison issue, thinking my other topic was dead, but then someone started responding in the other one so I am talking in circles in both. lol.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.