Skip to content

Commit

Permalink
Allow for all MySQL values of TIME data type
Browse files Browse the repository at this point in the history
We show slider only for occasionally used times from 00:00:00 to 23:59:59,
but allow for other times when entered by inputting directly in the textbox.

Fix #12637

Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
  • Loading branch information
devenbansod committed Oct 20, 2016
1 parent 9aa081f commit c367f93
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions js/functions.js
Expand Up @@ -152,6 +152,8 @@ function PMA_addDatepicker($this_element, type, options)
}
else if (type == "time") {
$this_element.timepicker($.extend(defaultOptions, options));
// Add a tip regarding entering MySQL allowed-values for TIME data-type
PMA_tooltip($this_element, 'input', PMA_messages.strMysqlAllowedValuesTip);
}
}

Expand Down Expand Up @@ -185,6 +187,11 @@ function addDateTimePicker() {
showMicrosec: showMicrosec,
timeFormat: timeFormat
});

// Add a tip regarding entering MySQL allowed-values for TIME data-type
if ($(this).hasClass('timefield')) {
PMA_tooltip($(this), 'input', PMA_messages.strMysqlAllowedValuesTip);
}
});
}
}
Expand Down
6 changes: 6 additions & 0 deletions js/messages.php
Expand Up @@ -517,6 +517,12 @@ function () {
$js_messages['strCopyEncryptionKey'] = __('Do you want to copy encryption key?');
$js_messages['strEncryptionKey'] = __('Encryption key');

/* For Tip to be shown on Time field */
$js_messages['strMysqlAllowedValuesTip'] = __(
'MySQL accepts additional values not selectable by the slider;'
. ' key in those values directly if desired'
);

/* For Lock symbol Tooltip */
$js_messages['strLockToolTip'] = __(
'Indicates that you have made changes to this page;'
Expand Down
2 changes: 1 addition & 1 deletion js/tbl_change.js
Expand Up @@ -143,7 +143,7 @@ function isTime(val)
}
}
val = arrayVal.join(":");
var tmexp = new RegExp(/^(([0-1][0-9])|(2[0-3])):((0[0-9])|([1-5][0-9])):((0[0-9])|([1-5][0-9]))(\.[0-9]{1,6}){0,1}$/);
var tmexp = new RegExp(/^(-)?(([0-7]?[0-9][0-9])|(8[0-2][0-9])|(83[0-8])):((0[0-9])|([1-5][0-9])):((0[0-9])|([1-5][0-9]))(\.[0-9]{1,6}){0,1}$/);
return tmexp.test(val);
}

Expand Down

0 comments on commit c367f93

Please sign in to comment.