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

Can't Set DateFormat on Date #21

Closed
GoogleCodeExporter opened this issue Jul 16, 2015 · 2 comments
Closed

Can't Set DateFormat on Date #21

GoogleCodeExporter opened this issue Jul 16, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Hi,

There should be an option to set the dateFormat for the date method.

You should be able to do something like:

    $form->addDate("Date:", "date", "", array("dateFormat" => 'dd/mm/yy'));

Here is my patch to add this feature:

line 1532:
                    $jqueryDateIDArr[] = $ele->attributes["id"];
                    $jqueryDateFormat[] = $ele->attributes["dateFormat"];

line 2031:
            if(!empty($jqueryDateIDArr)) {
                $dateSize = sizeof($jqueryDateIDArr);
                for($d = 0; $d < $dateSize; ++$d) {
                    if( $jqueryDateFormat[$d] != '' ) {
                        $str .= "\n\t\t\t" . '$("#' . $jqueryDateIDArr[$d]
. '").datepicker({ dateFormat: "'. $jqueryDateFormat[$d] .'",
showButtonPanel: true });';
                    } else {
                        $str .= "\n\t\t\t" . '$("#' . $jqueryDateIDArr[$d]
. '").datepicker({ dateFormat: "MM d, yy" , showButtonPanel: true });';
                    }
                }
            }

Original issue reported on code.google.com by moncojhr@gmail.com on 3 Mar 2010 at 3:36

@GoogleCodeExporter
Copy link
Author

Original comment by ajporterfield@gmail.com on 3 Mar 2010 at 4:47

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I added jqueryDateFormat as a form attribute that can be used to control the 
formatting 
of the dates returned by both the date and daterange fields.  Because this is a 
form 
attribute and not a field attribute, it is specified in the form's 
setAttributes method and 
not when adding each individual date/daterange field with the 
addDate/addDateRange 
method.

A complete reference of available options for the jqueryDateFormat attribute 
can be 
found at http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate.

Original comment by ajporterfield@gmail.com on 3 Mar 2010 at 5:11

  • Changed state: Fixed

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

1 participant