螳螂自定义字段“日期”给出奇数默认值


Mantis custom field "date" giving odd default values

为了在客户打开新问题时收集制造日期,我在Mantis安装(cur ver)中添加了一个自定义字段,类型为"date"。我没有指定默认值或可能的值。

Mantis 自行创建以下 HTML:

<tr class="row-2">
    <td class="category"><span class="required">*</span>Date of Manufacture</td>
    <td>
        <select tabindex="6" name="custom_field_3_year">
            <option value="0"></option>
            <option value="2011">2011</option>
            ...snip...
            <option value="2019">2019</option>
        </select>
        <select tabindex="7" name="custom_field_3_month">
            <option value="0"></option>
            <option value="1">January</option>
            ...snip...
            <option value="12">December</option>
        </select>
        <select tabindex="8" name="custom_field_3_day">
            <option value="0"></option>
            <option value="1">1</option>
            ...snip...
            <option value="31">31</option>
        </select>
    </td>
</tr>

月份和日期位是可以的,我们并不特别关心用户是否输入像 2 月 30 日这样不可能的一天。

然而,岁月被搞砸了。无论出于何种原因,它从2011年开始,一直持续到2019年。因为它是一个选择框,所以您无法手动输入日期。

什么决定了年份范围?如何将其设置为适当的值?

我在MantisBT帮助论坛上找到了问题的答案。

将这些行添加到文件config_inc.php并根据您的需求进行调整

   /**
    * Number of years in the past that custom date fields will display in
    * drop down boxes.
    * @global int $g_backward_year_count
    */
   $g_backward_year_count             = 4;
   /**
    * Number of years in the future that custom date fields will display in
    * drop down boxes.
    * @global int $g_forward_year_count
    */
   $g_forward_year_count             = 4;