tuke Posted April 16, 2013 Share Posted April 16, 2013 I'm trying to build a date input field with following functionality: - Date can be manually typed using format dd.mm.yyyy - Date can be selected using datepicker (which should output the date in dd.mm.yyyy format) The problem is that the date field only accepts dashes (-) as a separator so the date must be entered using format mm-dd-yyyy. Also, when a date is selected using datepicked, it is outputted in mm-dd-yyyy format. How can I change the format to dd.mm.yyyy? I tried to change the format settings but it had no effect. My settings: I'm using Processwire 2.3.0. EDIT: The datepicker works correctly in admin section but not in my front-end custom page. Link to comment Share on other sites More sharing options...
kongondo Posted April 16, 2013 Share Posted April 16, 2013 I've just tested and it works fine for me (English version). In the input field settings, it says that what is in the Date Input Format Code is automatically build from the date select above, unless you modify it. I have played with modifying it myself and letting PW do it for me and it still works...It accepts dots, dashes, slashes...Not sure why it's not working for you.. Link to comment Share on other sites More sharing options...
apeisa Posted April 17, 2013 Share Posted April 17, 2013 You should be able to pick that kind of date from dropdown. 8.4.2010 Link to comment Share on other sites More sharing options...
tuke Posted April 17, 2013 Author Share Posted April 17, 2013 For some reason it is not working in my installation. The input field is generated using: $field = $modules->get("InputfieldDatetime"); $field->label = "Aika"; $field->attr('id+name','time'); $field->required = 1; $form->append($field); // append the field And it outputs: <input id="time" class="InputfieldDatetimeDatepicker InputfieldDatetimeDatepicker3" name="time" type="text" size="25" value='' data-dateformat='yy-mm-dd' data-timeformat='' data-ts='0' data-ampm='1' /> Link to comment Share on other sites More sharing options...
tuke Posted April 17, 2013 Author Share Posted April 17, 2013 If I understand this correctly, the InputFieldDatetime.js javascript code reads the date format from the data-dateformat html property (as shown in the post above). Somehow the date-dateformat property is incorrect. I also found out that the datepicker works correctly in admin section but not in my front-end custom page. Link to comment Share on other sites More sharing options...
Soma Posted April 17, 2013 Share Posted April 17, 2013 jQuery UI datepicker has different date formats than in PHP and not compatible. Maybe it's that. $field = $modules->get("InputfieldDatetime"); $field->label = "Aika"; $field->attr('id+name','time'); $field->required = 1; $form->append($field); // append the field Also I don't see any date formatting here... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now