View Issue Details

IDProjectCategoryView StatusLast Update
0023578mantisbtdocumentationpublic2017-12-06 05:01
Reporternaib Assigned Todregad  
PrioritynormalSeveritytextReproducibilityalways
Status closedResolutionfixed 
Product Version2.7.1 
Target Version2.9.0Fixed in Version2.9.0 
Summary0023578: Document need for consistency between "normal" and "datepicker" date formats
Description

Original issue summary: Odd display in project version date after upgrading from 1.1.2 -> 1.3.12 -> 2.7.1

In my installation, after following the upgrade path noted above, if I attempt to edit the Date Order value, I notice that it is formatted in an odd way, and looking at the HTML, the date picker seems to be using the value attribute as a literal value for the data-picker-format to format.

<input id="proj-version-date-order" name="date_order" class="datetimepicker input-sm" data-picker-locale="en-us" data-picker-format="Y-MM-DD HH:mm" size="16" value="14 12 2017 09:30" style="" type="text">

My configuration contains the following:

$g_short_date_format      = &quot;d/m/Y&quot;;
$g_normal_date_format     = &quot;d m Y H:i&quot;;
$g_complete_date_format   = &quot;d m Y H:i T&quot;;
#$g_datetime_picker_format = &quot;D MMM Y H:mm&quot;;

$g_datetime_picker_format is commented out because it causes further problems.

TagsNo tags attached.
Attached Files
Screenshot-2017-11-2a.png (6,660 bytes)   
Screenshot-2017-11-2a.png (6,660 bytes)   
Screenshot-2017-11-2b.png (12,389 bytes)   
Screenshot-2017-11-2b.png (12,389 bytes)   

Relationships

related to 0023606 closedatrol editing an existing version corrupts date field 
related to 0022827 closedatrol Wrong dates in "Edit Project Version" 
related to 0023701 new different or localized datetime formats delete due_date on updates 

Activities

naib

naib

2017-11-02 03:53

reporter   ~0058112

Datetime picker screenshot.

dregad

dregad

2017-11-02 05:26

developer   ~0058114

I believe this is due to the inconsistency between the MantisBT date format (d m Y H:i in your case) and the date picker's (defaulting to Y-MM-DD HH:mm since you commented out $g_datetime_picker_format).

Given the date 14.12.2017 in your screenshots as an example, the day becomes the year (14), and the year (2017) is truncated to 2 chars and becomes the day (20).

I suggest you try setting $g_datetime_picker_format as appropriate to match your normal date format (at least in the order of the date's elements, d/m/y).

Finally, with regards to `$g_datetime_picker_format = "D MMM Y H:mm"; causing further problems , I just tried this locally and it seems to work just fine AFAICT so I'm not sure what your problem is.

naib

naib

2017-11-02 22:56

reporter   ~0058118

Changing my configuration to:

$g_normal_date_format     = &quot;d M Y H:i&quot;;
$g_complete_date_format   = &quot;d M Y H:i T&quot;;
$g_datetime_picker_format = &quot;D MMM Y H:mm&quot;;

results in the expected date and datetime picker display. Is it a requirement of Mantis that $g_datetime_picker_format align with $g_normal_date_format?

The following configuration causes Mantis to misinterpret the values in the Date Order field:

$g_normal_date_format     = &quot;d m Y H:i&quot;;
$g_datetime_picker_format = &quot;D MMM Y H:mm&quot;;

the normal format is configured with a numeric month with leading zeros, while the picker format's month is e.g. "Jan".

dregad

dregad

2017-11-03 08:16

developer   ~0058125

Is it a requirement of Mantis that $g_datetime_picker_format align with $g_normal_date_format?

I never thought about it until today, but I guess it should be, reason being that the date value has to be passed on from Mantis (PHP) to the date picker (Javascript) - and back - via the input field's contents so the format should be consistent.

In any case, I fail to understand why you would want to use different formats to display dates. Doesn't make sense to me.

dregad

dregad

2017-11-03 10:15

developer   ~0058126

I updated the Admin Guide to reflect the need for $g_normal_date_format and $g_datetime_picker_format to be consistent.

naib

naib

2017-11-06 00:18

reporter   ~0058142

Just for reference, I want to use the following two formats, the shorter one for where space is a priority, the longer one for where I want clarity first:

  • 10 Nov 2017 11:07
  • 10 11 2017 11:07
dregad

dregad

2017-11-06 06:31

developer   ~0058145

I want to use the following two formats, the shorter one for where space is a priority, the longer one for where I want clarity first:

The places where the different date formats are used can only be changed in the source code, but you still need to maintain the consistency between $g_datetime_picker_format align and $g_normal_date_format.

With regards to "where space is a priority", this is why we have short_date_format. Check the docs for more info on where each format is used, or look at the source.

Related Changesets

MantisBT: master eae6f667

2017-11-03 06:09

dregad


Details Diff
Document need for consistency in date formats

$g_datetime_picker_format and $g_normal_date_format settings need to be
consistent.

Differences between them may result in unexpected behavior such as an
invalid interpretation of the date by the DateTime picker widget, or
errors trying to save a modified date.

Fixes 0023578
Affected Issues
0023578
mod - config_defaults_inc.php Diff File
mod - docbook/Admin_Guide/en-US/config/date.xml Diff File