• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the end date based on start date and duration(in days) in jquery?

 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to get the end date based on start date and duration in jquery?.

I tried googling it most of the resolution was to get the duration for start date and end date.Please advice.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You wouldn't use jQuery for this. Why would you use jQuery to manipulate a Date?

Everything you need is in the Date object. Look at the APi and give the code a try. Then post with your code if you still have questions.
 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried with the below code


Please advice where I am going wrong?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open the browser debugger and step through the code. Does each line do what you think it does?

Hint: the value of form controls are strings.
 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Open the browser debugger and step through the code. Does each line do what you think it does?

Hint: the value of form controls are strings.



I need to typecast into Date?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing is typecasting in JavaScript. If you want to be able to perform numerical math on string values, they'll need to be converted to numbers. You will find the necessary methods on the window object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic