diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-04-15 06:25:44 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-04-15 06:25:44 +0300 |
commit | 91da1a8f38eb94e7d5c9b7dd4aac57b257ce17f3 (patch) | |
tree | 2c70cccc6a05909456eb98709672d06452e5309f /js/functions.js | |
parent | 5d18ac872cab5e3e70f86e5103c450aa52e43117 (diff) |
Fix issues related to number of decimal places in time
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/functions.js')
-rw-r--r-- | js/functions.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/js/functions.js b/js/functions.js index 9e49f2cf9f..41381481eb 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1115,19 +1115,24 @@ function addDateTimePicker() { if ($.timepicker !== undefined) { $('input.timefield, input.datefield, input.datetimefield').each(function () { - no_decimals = $(this).parent().attr('data-decimals'); + var decimals = $(this).parent().attr('data-decimals'); + var type = $(this).parent().attr('data-type'); + var showMillisec = false; var showMicrosec = false; var timeFormat = 'HH:mm:ss'; // check for decimal places of seconds - if (($(this).parent().attr('data-decimals') > 0) && ($(this).parent().attr('data-type').indexOf('time') != -1)){ - showMillisec = true; - timeFormat = 'HH:mm:ss.lc'; - if ($(this).parent().attr('data-decimals') > 3) { + if (decimals > 0 && type.indexOf('time') != -1){ + if (decimals > 3) { + showMillisec = true; showMicrosec = true; + timeFormat = 'HH:mm:ss.lc'; + } else { + showMillisec = true; + timeFormat = 'HH:mm:ss.l'; } } - PMA_addDatepicker($(this), $(this).parent().attr('data-type'), { + PMA_addDatepicker($(this), type, { showMillisec: showMillisec, showMicrosec: showMicrosec, timeFormat: timeFormat |