Fixed up scheduling logic using UTC dates instead of local dates. Updated scheduling header. Fixed month view not showing. BOD-179

This commit is contained in:
Patrick Fic
2020-08-10 11:59:12 -07:00
parent 3862f7f11f
commit 0df61a2701
12 changed files with 75 additions and 73 deletions

View File

@@ -53,7 +53,7 @@ exports.job = async (req, res) => {
//Initialize the bucket matrix
for (i = 0; i < totalMatrixDays; i++) {
const theDate = moment().add(i, "days").toISOString().substr(0, 10);
const theDate = moment().add(i, "days").format("yyyy-MM-DD");
//Only need to create a matrix for jobs of the same bucket.
bucketMatrix[theDate] = { in: 0, out: 0 };
@@ -76,7 +76,7 @@ exports.job = async (req, res) => {
)[0];
if (appointmentBucket.id === JobBucket.id) {
//Theyre the same classification. Add it to the matrix.
const appDate = moment(appointment.start).toISOString().substr(0, 10);
const appDate = moment(appointment.start).format("yyyy-MM-DD");
bucketMatrix[appDate] = {
...bucketMatrix[appDate],
in: bucketMatrix[appDate].in + 1,
@@ -85,7 +85,7 @@ exports.job = async (req, res) => {
});
//Populate the jobs that are leaving today.
const todayIsoString = moment().toISOString().substr(0, 10);
const todayIsoString = moment().format("yyyy-MM-DD");
productionview.forEach((pjob) => {
const jobHrs = pjob.larhrs + pjob.labhrs;
//Is the job in the same bucket?
@@ -100,7 +100,7 @@ exports.job = async (req, res) => {
let dateToUse;
dateToUse = compDate.isValid()
? moment().diff(compDate, "days") <= 0
? compDate.toISOString().substr(0, 10)
? compDate.format("yyyy-MM-DD")
: todayIsoString
: todayIsoString;