Skip to content

Commit

Permalink
Update documentation for setDateFormatter
Browse files Browse the repository at this point in the history
Include how to opt-in to the built-in moment.js configuration and document the new formatMask property.
  • Loading branch information
nireno committed Feb 12, 2018
1 parent 8842bfe commit 2509a69
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,18 @@ jQuery('#_datetimepicker_weekends_disable').datetimepicker({
formatDate: function (date, format) {
return moment(date).format(format);
},
//Optional if using mask input
formatMask: function(format){
return format
.replace(/Y{4}/g, '9999')
.replace(/Y{2}/g, '99')
.replace(/M{2}/g, '19')
.replace(/D{2}/g, '39')
.replace(/H{2}/g, '29')
.replace(/m{2}/g, '59')
.replace(/s{2}/g, '59');
}
});
</code></pre>
Expand All @@ -381,6 +393,8 @@ jQuery('#_datetimepicker_weekends_disable').datetimepicker({
formatTime:'h:mm a',
formatDate:'DD.MM.YYYY'
});</code></pre>
<p>Because of its popularity, moment.js has a pre-defined configuration that can be enabled with:</p>
<pre><code class="language-javascript">$.datetimepicker.setDateFormatter('moment');</code></pre>
<hr id="range" />
<h4>Range between date<a href="#range">#</a></h4>
<p><strong>javaScript</strong></p>
Expand Down

0 comments on commit 2509a69

Please sign in to comment.