Customize a custom field using a date attribute

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
rudy
Posts: 10
Joined: 12 Apr 2006, 14:36
Location: Paris

Customize a custom field using a date attribute

Post by rudy »

Hello,

I'm using a custom field using a date attribute. In the report bug's page, the default setting is set on M-d-Y, i'd like to change this to d-M-Y.
Any idea?

Any help would be much appreciated !
undergrid
Posts: 14
Joined: 25 Feb 2005, 00:50

Post by undergrid »

Hi there,

The custom date controls use the format defined in the g_short_date_format configuration option. To change it as you require it, add the following to your config_inc.php

Code: Select all

$g_short_date_format = 'd-M-Y';
Note that this will change all dates currently in the M-d-Y format to d-M-Y.

To change the format of custom date fields only you can create your own custom config. First, define the format in config_inc.php

Code: Select all

$g_custom_date_format = 'd-M-Y';
In core\custom_field_api.php there are three instances (assuming your using 1.0.3) where 'short_date_format' is used (lines 1209, 1234 and 1270 in my copy). Change each of these to 'custom_date_format'. I think thats all you'd have to change.

Nick
rudy
Posts: 10
Joined: 12 Apr 2006, 14:36
Location: Paris

Post by rudy »

Thanks a lot,

I tried it and it works perfectly.
Post Reply