Skip to content

Commit

Permalink
Merge pull request #270 from icefoganalytics/test
Browse files Browse the repository at this point in the history
Fixing odd date glitch when end date falls on the last day of the week
  • Loading branch information
datajohnson authored Jun 27, 2024
2 parents d23fc43 + 2c277c4 commit d012677
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/utils/date-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import moment from "moment";
export function weeksBetween(start: Date | string | undefined, end: Date | string | undefined): number {
if (isUndefined(start) || isUndefined(end)) return 0;

const weeks = Math.ceil(moment.utc(end).endOf("week").diff(moment.utc(start).startOf("week"), "week", true));
const weeks = Math.ceil(moment.utc(end).endOf("week").diff(moment.utc(start).startOf("week"), "week", false));

if (weeks == 53) {
const days = Math.ceil(moment.utc(end).diff(moment.utc(start), "days", true));
Expand Down

0 comments on commit d012677

Please sign in to comment.