I am having trouble using bootstrap datetimepicker with the initialization code like this:
$('#departure-time').datetimepicker({
todayHighlight: true,
autoclose: true,
format: 'yyyy-mm-dd hh:ii'
}).on('change', function () {
});
I cannot figure out how to select only the time. I tried setting the format to :
format: 'hh:ii'
But it didn't work.
Which approach should I take?
The dependencies in my project include:
"bootstrap": "^4.4.1",
"bootstrap-datepicker": "^1.8.0",
"bootstrap-daterangepicker": "^3.0.3",
"bootstrap-datetime-picker": "^2.4.4",
"bootstrap-datetimepicker": "^0.0.7",
UPDATED: The project is utilizing "jquery": "^3.3.1", and switching to "jquery 2" is not feasible due to compatibility issues. Could this be causing the error message:
“Uncaught Error: Invalid date format. at Object.parseFormat”
which appears in the console when I initialize the Datetimepicker as follows:
$('#time_utc').datetimepicker({
todayHighlight: true,
autoclose: true,
format: 'LT',
}).on('change', function () {
});
Is there a way to resolve this error?
UPDATED # 2: I attempted to upgrade bootstrap-datetimepicker to version 4.17.47, which seems to be the latest version according to https://github.com/Eonasdan/bootstrap-datetimepicker
However, I encountered issues during the upgrade process. In the package.json file of my project, I have the following line:
"bootstrap-datetimepicker": "^0.0.7",
I tried changing it to:
"bootstrap-datetimepicker": "^4.17.47",
But when running npm install, I received an error message:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for bootstrap-datetimepicker@^4.17.47.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
I then modified it to
"bootstrap-datetimepicker": "4.17.47",
Yet again, running npm install resulted in a similar error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e6848989929592948796cb82879283928f8b83968f858d8394a6d2c8d7d1c8d2d1">[email protected]</a>.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
I decided to remove bootstrap-datetimepicker from the package.json
and ran:
npm install bootstrap-datetimepicker
After installation, I noticed that the package.json still shows:
"bootstrap-datetimepicker": "0.0.7",
This essentially brought me back to square one.
Furthermore, please review the contents of the package.json file:
{
"private": true,
...
}
This file contains a multitude of packages. I am new to this project and seeking assistance to identify the potential cause of the errors mentioned above.
Thank you!