summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorivan <ivan>2010-03-08 10:57:18 +0000
committerivan <ivan>2010-03-08 10:57:18 +0000
commitdc404e7519cf0ec3a0024a662c5e0c5566f9a194 (patch)
tree4f803ba340549798101094b822bd938eb70596cb /httemplate/elements
parent3402ff329fde97d6ac96723b5c2a4ed46ed2ce25 (diff)
proper use of date_format config for international date formats, RT#7009
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/tr-input-beginning_ending.html8
-rw-r--r--httemplate/elements/tr-input-date-field.html7
2 files changed, 11 insertions, 4 deletions
diff --git a/httemplate/elements/tr-input-beginning_ending.html b/httemplate/elements/tr-input-beginning_ending.html
index 8a1dd62a9..2aa597479 100644
--- a/httemplate/elements/tr-input-beginning_ending.html
+++ b/httemplate/elements/tr-input-beginning_ending.html
@@ -11,7 +11,7 @@
<SCRIPT TYPE="text/javascript">
Calendar.setup({
inputField: "<% $opt{prefix} %>beginning_text",
- ifFormat: "%m/%d/%Y<% $time_format %>",
+ ifFormat: "<% $date_format. $time_format %>",
button: "<% $opt{prefix} %>beginning_button",
align: "BR"
<% $input_time %>
@@ -30,7 +30,7 @@
<SCRIPT TYPE="text/javascript">
Calendar.setup({
inputField: "<% $opt{prefix} %>ending_text",
- ifFormat: "%m/%d/%Y<% $time_format %>",
+ ifFormat: "<% $date_format. $time_format %>",
button: "<% $opt{prefix} %>ending_button",
align: "BR"
<% $input_time %>
@@ -54,6 +54,10 @@ my $previous_request_count = '';
my %opt = @_;
+my $conf = new FS::Conf;
+
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
$opt{prefix} = '' unless defined $opt{prefix};
$opt{prefix} .= '_' if $opt{prefix};
diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html
index 2a731e1e8..ff4996faf 100644
--- a/httemplate/elements/tr-input-date-field.html
+++ b/httemplate/elements/tr-input-date-field.html
@@ -21,8 +21,8 @@
});
</SCRIPT>
-
<%init>
+
my($name, $value, $label, $format, $usedatetime);
if ( ref($_[0]) ) {
my $opt = shift;
@@ -35,7 +35,10 @@ if ( ref($_[0]) ) {
($name, $value, $label, $format, $usedatetime) = @_;
}
-$format = "%m/%d/%Y" unless $format;
+my $conf = new FS::Conf;
+
+$format ||= $conf->config('date_format') || '%m/%d/%Y';
+
$label = $name unless $label;
if ( $value =~ /\S/ ) {