Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

how to compares dates in javascript

$
0
0

Good day everyone,

 

I'm trying to come up with a way to write a Fiscal Year piece of code and so far I'm just having issues finding the right functions in JavaScript to help me do this.

so far I got this:

 

var d1 =new Date("Dec 28, 2014");

var yr1= d1.getFullYear();

var stryr1=yr1.toString();

//var checkdateagainst="April 01, " + stryr1;

var CurDate = stryr1.substr(-2,2);

var yr2 = yr1 + 1;

var stryr2=yr2.toString();

var FutureDate = stryr2.substr(-2,2);

var fy= CurDate + "-" + FutureDate;

 

This works in giving me the FY format I'm looking for which is: YY-YY

So basically I need to check the current system date against the date that would be the cut off date for adding a new fiscal year.

So if current date(May 28 2014) > "April 01" (of this year) =yes, then this means that I'm in a new fiscal year and I want to add fy to my dropdown choices.


"April 1st" is static and never changes except for the year its in. I hope this makes sense if it doesn't I can try to clarify more or if you guys just know at least how to do a compare between 2 dates to see if one is bigger then the other (so-to-speak), It would be of great help to me.


Thank you very much

 


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>