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

request for add new prefix on dateFormat #34

Open
lesar opened this issue Jan 7, 2016 · 2 comments
Open

request for add new prefix on dateFormat #34

lesar opened this issue Jan 7, 2016 · 2 comments
Assignees
Milestone

Comments

@lesar
Copy link

lesar commented Jan 7, 2016

I'm fighting to format date in DatePicker. I like to set dateFormat in js manner without any transformation. so in my project I have subclassed datePiker and changed the run method from line 142:

            if (strncmp($this->dateFormat, 'php:', 4) === 0) {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
            } else {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
            }

to:

            if (strncmp($this->dateFormat, 'php:', 4) === 0) {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDatePhpToJui(substr($this->dateFormat, 4));
            } else if (strncmp($this->dateFormat, 'js:', 3) === 0) {
                    $this->clientOptions['dateFormat'] = substr($this->dateFormat, 3);
            } else {
                    $this->clientOptions['dateFormat'] = FormatConverter::convertDateIcuToJui($this->dateFormat, 'date', $language);
            }

I think that this can be usefoul and work very well.
Can you put this change in your code?

@cebe
Copy link
Member

cebe commented Jan 7, 2016

A better option would be to only populate $this->clientOptions['dateFormat'] if it is not set already, so you can set it in clientOptions using the JS format.

@cebe cebe added this to the 2.0.5 milestone Jan 7, 2016
@lesar
Copy link
Author

lesar commented Jan 7, 2016

Thank you for the answer. Yes your option it will be a good solution. on the other hand on this solution when the user write configuration, dateFormat setting is inside clientOptions and outside it. This can increase user confusing.
when you have choose one solution let me know so I update my project to be in sync with your choose.
Regards

@cebe cebe modified the milestones: 2.0.6, 2.0.5 Mar 17, 2016
@samdark samdark modified the milestones: 2.0.6, 2.0.7 Jul 22, 2016
@samdark samdark modified the milestones: 2.0.7, 2.0.8 Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants