Support Forums

Extra field date format

This is a discussion on Extra field date format within the Templates, HTML, CSS, and Design Help forums, part of the General category; Does anyone know where you can modify the format of a 'Date Type' extra field? It's currently formatted as yyyy-mm-dd. ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 03-06-2011, 11:23 AM   #1
Customer
 
Join Date: Jan 2010
Posts: 70
Rep Power: 8
metrony is on a distinguished road
Default Extra field date format

Does anyone know where you can modify the format of a 'Date Type' extra field? It's currently formatted as yyyy-mm-dd. I thought it would be controlled by the regional settings but it appears to be separate from that.

Thanks in advance.
__________________
Metro New York Apartments
Apartment listings for the Metro New York Area
metrony is offline   Reply With Quote
Old 03-06-2011, 04:58 PM   #2
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,149
Rep Power: 68
John Snyder is a jewel in the rough
Default

I'm afraid this is a global setting done via the date_input jquery plugin. You can change it but it will affect all date fields that use the date picker.

javascript/jquery/date_input/jquery.date_input.min.js:
Code:
$.extend(DateInput.DEFAULT_OPTS, {
  stringToDate: function(string) {
    var matches;
    if (matches = string.match(/^(\d{4,4})-(\d{2,2})-(\d{2,2})$/)) {
      return new Date(matches[1], matches[2] - 1, matches[3]);
    } else {
      return null;
    };
  },
  dateToString: function(date) {
    var month = (date.getMonth() + 1).toString();
    var dom = date.getDate().toString();
    if (month.length == 1) month = "0" + month;
    if (dom.length == 1) dom = "0" + dom;
    return date.getFullYear() + "-" + month + "-" + dom;
  }
});
This could have some unforseen impact on listings expiration set via admin or etc. I'd be sure to test carefully if you decide to change this value.

You can change it only for listings but I'm not sure if its only a 1 place edit. Look in includes/classes/kernel/Listings.php You can attempt to do the javascript above when the field is built.

Find:
PHP Code:
//birthdate or date field
 
$optdata.='<script language="javascript" type="text/javascript">
                        $(function() {
                               // you can attempt to override again here like in the jquery.date_input.min.js file
                               $("#opt'
.$row['fID'].'").date_input();
                         });
                    </script>'

You can see more about the jquery plugin here: jQuery Date Input: Jon Leighton
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline   Reply With Quote
Old 03-07-2011, 07:06 PM   #3
Customer
 
Join Date: Jan 2010
Posts: 70
Rep Power: 8
metrony is on a distinguished road
Default

I don't use the field that often so I probably won't make the change. But thanks for letting me know where the changes need to be made.
__________________
Metro New York Apartments
Apartment listings for the Metro New York Area
metrony is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra Date Field slappy5150 Technical Support 3 05-14-2010 09:38 AM
Extra field display in checkout format problem rhound Technical Support 4 03-20-2009 02:53 PM
Change format in "date field" extra field topbidz Technical Support 2 05-01-2008 07:38 PM


All times are GMT -4. The time now is 09:39 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0