Skip to content

Conversation

gqcorneby
Copy link

@gqcorneby gqcorneby commented Sep 3, 2025

📌 References

📝 Implementation

  • generate and save dataInputPeriod
    • dataInputPeriod is generated based on attribute GL_INTERVAL_DATES (Data Input Dates)
    • Opening and closing dates are the min startDate and max endDate of GL_DATASET_PERIOD_DATES (Period Dates)
  • recalculate and save openFuturePeriods when selecting project or updating data input dates
  • update custom form to use GL_DATASET_PERIOD_DATES
  • Update date handling:
    • use toISODateWithoutTimezone when saving
    • With the current flow, saved short dates are -1 day because of timezone
      1. convert attribute short date (+8 timezone) -> new Date(2025, 3, 1, 0, 0, 0) April 1 2025 00:00:00 GMT+8
      2. in saving, we convert this date toISOString() then get the date value, which will be March 31 2025
        • new Date(2025, 3, 1, 0, 0, 0).toISOString() is 2025-03-31T16:00:00.000Z

TODO:

  • confirm period data value when project updates
    • should default be current periodDate or undefined (if project doesn't have start/end dates)

📹 Screenshots/Screen capture

CREATE DATA SET

2025-09-03.17-39-43.mp4

UPDATE 2027 CLOSING (fields disable fields)

2025-09-03.17-46-44.trimmed.mp4
2025-09-03.18-02-31.mp4

🔥 Notes to the tester

Copy link
Contributor

@eperedo eperedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[code review]. Looks good, just two minor observations. Thanks @gqcorneby

return [];
}

const allStartTimes = _(periods)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can extract this functionality into a private method and reuse it for start/end Times.

_(periods)
  .compactMap(p => stringToTime(p.startDate))
  .value();

Also I think the name of the variable should be allEndTimeS to be consistent with allStartTimes, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Eduardo! Minor thing but I went back and forth with this 😆 I thought it might be overkill to extract it as a method. Will apply 👍

0
).getDate();
const dayFraction = (dateBDay - dateADay) / daysInCurrentMonth;
monthDiff += dayFraction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, but normally we try to avoid mutating values. We can directly call to return monthDiff + dayFraction

Also I think the condition should be if (dateA.getTime() !== dateB.getTime()) to compare the actual dates and not the reference, right?

Example:

var a = new Date("2024-12-05");
var b = new Date("2024-12-05");
console.log(a !== b) // true
console.log(a.getTime() !== b.getTime()) // false

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thank you!

@gqcorneby gqcorneby requested a review from eperedo September 4, 2025 02:20
@MiquelAdell MiquelAdell merged commit e162f97 into development-project-configurator Sep 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants