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

[Feature Request] Use date format set by dformat #207

Open
SFITCS opened this issue Nov 26, 2016 · 0 comments
Open

[Feature Request] Use date format set by dformat #207

SFITCS opened this issue Nov 26, 2016 · 0 comments

Comments

@SFITCS
Copy link

SFITCS commented Nov 26, 2016

Priority low. I'm happy to keep hacking this feature into releases.
By default the plugin uses yy-mm-dd date format, regardless of what format is set in $conf['dformat'].
Unfortunately this does not suit Australia as we use the dd-mm-yy format.
I don't know how to automate the process of supporting the format set by $conf['dformat'], but it's currently a simple hack to force dd-mm-yy.

diff -r Original/data/helper.php Modified/data/helper.php
119,120c119,120
<                 if(preg_match('/^(\d\d\d\d)-(\d\d?)-(\d\d?)$/', $value, $m)) {
<                     return sprintf('%d-%02d-%02d', $m[1], $m[2], $m[3]);
---
>                 if(preg_match('/^(\d\d?)-(\d\d?)-(\d\d\d\d)$/', $value, $m)) {
>                     return sprintf('%02d-%02d-%d', $m[1], $m[2], $m[3]);
512c512
<         $data['sql'] = str_replace('%now%', dformat(null, '%Y-%m-%d'), $data['sql']);
---
>         $data['sql'] = str_replace('%now%', dformat(null, '%d-%m-%Y'), $data['sql']);
diff -r Original/data/script.js Modified/data/script.js
6c6
<         dateFormat: "yy-mm-dd",
---
>         dateFormat: "dd-mm-yy",
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

1 participant