Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setDate Error #182

Open
satheeshindr opened this issue Oct 7, 2016 · 0 comments
Open

setDate Error #182

satheeshindr opened this issue Oct 7, 2016 · 0 comments

Comments

@satheeshindr
Copy link

Hi,

Kinldy fix this error and update this setDate() function issue. Thanks.

ERROR CONSOLE LOG : jquery.simple-dtpicker.js:1004 Uncaught TypeError: Cannot read property '0' of undefined

Below my working code
var dateString = $('#startdatetime').val();
var reggie = /(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2})/;
var dateArray = reggie.exec(dateString);
var d = new Date((+dateArray[3]),(+dateArray[2])-1,(+dateArray[1]),(+dateArray[4]),(+dateArray[5]));
d.setHours(d.getHours() + 1);
var endTime = ((d.getDate()<10?'0':'') + d.getDate())+"-"+(((d.getMonth() + 1)<10?'0':'') +(d.getMonth() + 1) )+"-"+d.getFullYear()+" "+((d.getHours()<10?'0':'') + d.getHours())+":"+((d.getMinutes()<10?'0':'') + d.getMinutes());
$('#enddatetime').handleDtpicker('setDate', new Date(d));

Regards,
MSK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant