Skip to content

Commit

Permalink
Merge pull request #2 from moqui/master
Browse files Browse the repository at this point in the history
Fix bug moqui#40 datetime picker not work when setting defaultDate with cu…
  • Loading branch information
mrovnanik authored Jul 21, 2016
2 parents 4356038 + 86e1dc9 commit 41ba9c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions template/screen-macro/DefaultScreenMacros.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ ${sri.renderIncludeScreen(.node["@location"], .node["@share-scope"]!)}
<input type="text" class="form-control" name="${curFieldName}_from" value="${fieldValueFrom?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<script>$('#${id}_from').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate:'${fieldValueFrom?html}', format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<script>$('#${id}_from').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate:'${fieldValueFrom?html}' && moment('${fieldValueFrom?html}','${datepickerFormat}'), format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<#else>
<input type="text" class="form-control" pattern="^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$"
name="${curFieldName}_from" value="${fieldValueFrom?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
Expand All @@ -1473,7 +1473,7 @@ ${sri.renderIncludeScreen(.node["@location"], .node["@share-scope"]!)}
<input type="text" class="form-control" name="${curFieldName}_thru" value="${fieldValueThru?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<script>$('#${id}_thru').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate:'${fieldValueThru?html}', format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<script>$('#${id}_thru').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate:'${fieldValueThru?html}' && moment('${fieldValueThru?html}','${datepickerFormat}'), format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<#else>
<input type="text" class="form-control" pattern="^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$"
name="${curFieldName}_thru" value="${fieldValueThru?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
Expand Down Expand Up @@ -1570,7 +1570,7 @@ a => A, d => D, y => Y
<input type="text" class="form-control" name="<@fieldName .node/>" value="${fieldValue?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
<script>$('#${id}').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate:'${fieldValue?html}', format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<script>$('#${id}').datetimepicker({toolbarPlacement:'top', showClose:true, showClear:true, showTodayButton:true, defaultDate: '${fieldValue?html}' && moment('${fieldValue?html}','${datepickerFormat}'), format:'${datepickerFormat}', stepping:5, locale:"${ec.user.locale.toLanguageTag()}"});</script>
<#else>
<#-- datetimepicker does not support time only, even with plain HH:mm format; use a regex to validate time format -->
<input type="text" class="form-control" pattern="^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$" name="<@fieldName .node/>" value="${fieldValue?html}" size="${size}" maxlength="${maxlength}"<#if .node?parent["@tooltip"]?has_content> data-toggle="tooltip" title="${ec.resource.expand(.node?parent["@tooltip"], "")}"</#if>>
Expand Down

0 comments on commit 41ba9c7

Please sign in to comment.