Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/72cb436d4c5f5ce15e535c656b27f643 to your computer and use it in GitHub Desktop.

Select an option

Save trycf/72cb436d4c5f5ce15e535c656b27f643 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
getRanges = function() {
var ranges = [30, 60, 90, 180];
var today = dateFormat(now(), "mm/dd/yyyy");
return ranges.map((r) => {
var start = dateFormat(dateAdd("d", -(r-1), today), "mm/dd/yyyy");
return {
"range_display": "Last #r# Days",
"key": -#r#,
"start_date": start,
"end_date": today
}
});
}
writedump(
getRanges()
);
//*
var today = dateFormat(now(), "mm/dd/yyyy");
in30 = dateFormat(dateAdd("d", -29, today), "mm/dd/yyyy");
writedump(today);
writedump(in30);
//*/
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment