Click here to Skip to main content
15,890,512 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionBlock thread Pin
Leng Vang18-Mar-14 5:40
Leng Vang18-Mar-14 5:40 
QuestionRe: Block thread Pin
ZurdoDev20-Mar-14 15:41
professionalZurdoDev20-Mar-14 15:41 
AnswerRe: Block thread Pin
Leng Vang24-Mar-14 6:12
Leng Vang24-Mar-14 6:12 
GeneralRe: Block thread Pin
ZurdoDev24-Mar-14 6:23
professionalZurdoDev24-Mar-14 6:23 
QuestionDate Validation Pin
AshBhande18-Mar-14 1:01
AshBhande18-Mar-14 1:01 
AnswerRe: Date Validation Pin
Richard MacCutchan18-Mar-14 6:59
mveRichard MacCutchan18-Mar-14 6:59 
AnswerRe: Date Validation Pin
ClimerChinna18-Mar-14 20:33
ClimerChinna18-Mar-14 20:33 
AnswerRe: Date Validation Pin
Praneet Nadkar4-May-14 22:46
Praneet Nadkar4-May-14 22:46 
Hi,
Did you mean

Start Date > (Now - 2 years)
End Date < (Now + 2 years)

instead of
Start Date > (Now - 2 years)
Start Date < (Now + 2 years)

also, Is it a validation or to be calculated.

I have not tested or ran the code, just gave it a try.

var duration = 2;
var startDate= new Date(); // You can take the input in here
var endDate = new Date(); // you can take the input end date here too.
var rollOutDate = new Date();

startDate.setFullYear( expiryDate.getFullYear() - duration );
endDate.setFullYear( expiryDate.getFullYear() + duration );

var difference = endDate - startDate;
var difference1 = rollOutDate - endDate; //i dont know which is greater here
var oneDay = 1000*60*60*24;
var oneYear = oneDay / 365;

var checkStartEndDate = Math.round(difference / oneYear); // in no of days
var checkRollEndDate = Math.round(difference1 / oneYear); // in no of days

if(checkStartEndDate < 2 && checkRollEndDate < 1 )
{
return true;
// You can also search and try the following
//Page.IsValid = true;
}

else
{
return false;
// You can also search and try the following
//Page.IsValid = false;
}

Apologies if I missed something.
QuestionFacebook share button is not working Pin
Member 803236014-Mar-14 21:46
Member 803236014-Mar-14 21:46 
AnswerRe: Facebook share button is not working Pin
ZurdoDev20-Mar-14 15:41
professionalZurdoDev20-Mar-14 15:41 
GeneralRe: Facebook share button is not working Pin
Sunasara Imdadhusen26-May-14 21:24
professionalSunasara Imdadhusen26-May-14 21:24 
Questionddslick set Max height Pin
saigowthami14-Mar-14 17:24
saigowthami14-Mar-14 17:24 
SuggestionRe: ddslick set Max height Pin
ZurdoDev20-Mar-14 15:43
professionalZurdoDev20-Mar-14 15:43 
Questionpop window Pin
Member 1003910910-Mar-14 20:33
Member 1003910910-Mar-14 20:33 
SuggestionRe: pop window Pin
ZurdoDev20-Mar-14 15:45
professionalZurdoDev20-Mar-14 15:45 
QuestionTrying to compare cancel from prompt dialog not working Pin
RabbitTrail10-Mar-14 11:43
RabbitTrail10-Mar-14 11:43 
AnswerRe: Trying to compare cancel from prompt dialog not working Pin
Kornfeld Eliyahu Peter10-Mar-14 21:57
professionalKornfeld Eliyahu Peter10-Mar-14 21:57 
AnswerRe: Trying to compare cancel from prompt dialog not working Pin
ZurdoDev13-Mar-14 6:44
professionalZurdoDev13-Mar-14 6:44 
AnswerRe: Trying to compare cancel from prompt dialog not working Pin
twseitex13-Mar-14 9:28
twseitex13-Mar-14 9:28 
QuestionHow to write confirmation message? Pin
Member 1062605710-Mar-14 0:08
Member 1062605710-Mar-14 0:08 
AnswerRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:29
professionalthatraja10-Mar-14 2:29 
GeneralRe: How to write confirmation message? Pin
Member 1062605710-Mar-14 2:45
Member 1062605710-Mar-14 2:45 
GeneralRe: How to write confirmation message? Pin
thatraja10-Mar-14 2:59
professionalthatraja10-Mar-14 2:59 
GeneralRe: How to write confirmation message? Pin
Praneet Nadkar4-May-14 23:22
Praneet Nadkar4-May-14 23:22 
GeneralRe: How to write confirmation message? Pin
thatraja4-May-14 23:28
professionalthatraja4-May-14 23:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.