CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/purchases/closing-date.ts
Views: 687
1
export function resetDay(date: Date): number {
2
let day = date.getDate();
3
// if date is within 8 hours of the upcoming midnight in UTC, add 1 to day.
4
// This is to make sure a statement still gets cut after making the change.
5
const hours = date.getUTCHours();
6
if (hours >= 16) {
7
day += 1;
8
}
9
if (day > 28) {
10
return 1;
11
}
12
return day;
13
}
14
15