Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

95
Views
Jquery datepicker parsing date/time error

I could not resolve the parsing date/time error from Struts2 jquery tag datepicker when setting the minDate. Have tried both date and timestamp as the minDate parameter but the error is still showing. There is no online solution so to seek for some solutions here. I require the datetime format to be (dd M yy HH:mm:ss). Error is logged by timepicker v1.6.3.

Error Line

e.timepicker.log = function() {
    window.console && window.console.log && window.console.log.apply && window.console.log.apply(window.console, Array.prototype.slice.call(arguments))
}

Library

  • jQuery v3.5.1
  • jQuery UI v1.12.1
  • jQuery Migrate v3.3.1
  • jQuery Struts2 v4.0.3

JSP

<%@ taglib uri="/struts-jquery-tags" prefix="sj" %>  
<sj:datepicker key="document.startDate" size="20" maxlength="20" readonly="true" id="startDate" changeMonth="true" changeYear="true" timepicker="true" showButtonPanel="true" showOn="focus" displayFormat="dd M yy" minDate="-3m +0d" maxDate="+12m +0d" requiredLabel="true" timepickerFormat="HH:mm:ss"/>

Javascript

$('#startDate').datepicker("option", "minDate", new Date("01 Oct 2016"));

Error shown in console:

Error parsing the date/time string: Unexpected literal at position 6

date/time string = 01 Jan 2021

timeFormat = HH:mm:ss

dateFormat = dd M yy

7 months ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.