feature in regional settings - date

7 posts by 3 authors in: Forums > CMS Builder
Last Post: April 9, 2009   (RSS)

By flamerz - February 8, 2009

Could we have date format as config option in regional settings?

Best regards.
Attachments:

dateformat.jpg 19K

dateformat-2.jpg 7K

Re: [flamerz] feature in regional settings - date

By Dave - February 9, 2009

Thanks for the suggestion and screenshots. I'll put this on the feature list for upcoming versions.

What format should the Created By and Last Updated dates be in if this was changed? Currently they are like this:
May 30th, 2008 - 11:28:48 AM
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] feature in regional settings - date

By flamerz - February 9, 2009 - edited: February 10, 2009

I only wanted to change display in cmseditor, not in the viewers. Are you talking about this?

Only two items in combo:

dd/mm/yyyy
mm/dd/yyyy (this order is now in cmsbuilder)

this post is related:
http://www.interactivetools.com/iforum/gforum.cgi?post=66194

/cmsAdmin/lib/menus/default/edit_functions.php

swap lines:

print " <select name='{$fieldSchema['name']}:mon'>$monthOptions</select>\n";
print " <select name='{$fieldSchema['name']}:day'>$dayOptions</select>\n";

Re: [Dave] feature in regional settings - date

Actually a field in the Regional Settings where you can cange the date format would be great. In Germany i.e. dates are in this format: d-m-Y

Re: [Dave] feature in regional settings - date

By flamerz - April 9, 2009 - edited: April 9, 2009

Here is my fix... im not php professional writer.

In editField.php, under showtime DIV (line 196 or so) add this:

<div class="label">Date Format</div>
<div>
<input type="hidden" name="euroStyle" value="0"/>
<input type="checkbox" id="date_eurostyle" name="euroStyle" value="1" <?php checkedIf($field['euroStyle'], '1') ?> />
<label for="date_eurostyle">European style date format (day, month, year)</label>
</div>

This will let you check european style date in cms.

In editField_functions.php
under line 20: $defaultValue['showTime'] = '1';
$defaultValue['euroStyle'] = '1'; // add this one

in line 278, fix date with:
'date' => array('customColumnType', 'order', 'label', 'type', 'isSystemField', 'adminOnly', 'isUnique', 'showTime', 'euroStyle', 'showSeconds', 'use24HourFormat', 'yearRangeStart', 'yearRangeEnd'),

and last.. in edit_functions.php around line 307 make this changes:

if ($fieldSchema['euroStyle']) {
print " <select name='{$fieldSchema['name']}:day'>$dayOptions</select>\n";
print " <select name='{$fieldSchema['name']}:mon'>$monthOptions</select>\n";
}
else {
print " <select name='{$fieldSchema['name']}:mon'>$monthOptions</select>\n";
print " <select name='{$fieldSchema['name']}:day'>$dayOptions</select>\n";
}

I hope this helps. Please, check my code, i fixed without check in deep.
Attachments:

clip1.jpg 33K

clip2.jpg 18K

Re: [flamerz] feature in regional settings - date

By Dave - April 9, 2009

Nice job. :) I'll review this code and put something in the next release (v1.29).

Thanks!
Dave Edis - Senior Developer
interactivetools.com