Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
Adobe Summit 2023 | Complete list of AEM Sessions & Labs
SOLVED

Using Fiscal year in calculation

Avatar

Level 4

I have a formula that defines a rate based on the year...   

}else if(Row2.YearTraveled.rawValue == "2022" && Row2.ddModeTransportation.rawValue == "Motorcycle"){
this.rawValue = ".605";
}

Now I need to break up this year to calculate based on time frames....1/1/22-6/30/22  is one rate and 7/1/22-12/31/22 is another.

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@ReluctantProgrammer should be doable

var d1 = new Date(); // start date
var d2 = new Date(d1); end date

console.log(d1 == d2);   // prints false (wrong!) 
console.log(d1 === d2);  // prints false (wrong!)
console.log(d1 != d2);   // prints true  (wrong!)
console.log(d1 !== d2);  // prints true  (wrong!)

similarly you can write if else (somedate>d1 && somedate <d2) {
//do some action
}
 

  

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

@ReluctantProgrammer should be doable

var d1 = new Date(); // start date
var d2 = new Date(d1); end date

console.log(d1 == d2);   // prints false (wrong!) 
console.log(d1 === d2);  // prints false (wrong!)
console.log(d1 != d2);   // prints true  (wrong!)
console.log(d1 !== d2);  // prints true  (wrong!)

similarly you can write if else (somedate>d1 && somedate <d2) {
//do some action
}