Skip to content

Conversation

@JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Jan 5, 2024

The moment project has been sunset for a bit now.
In efforts to move the FOLIO platform to a supported library with as easy a transition as possible. we intend to make the move to dayJS.
It's practically a drop-in replacement for moment, with a VERY similar API.

Its locale information is split from the main bundle and it's very modular/plugin-based.
stripes-components will re-export/provide the import for dayjs with numerous useful plugins included as well as utilities for dynamically loading dayjs locale data.

More information is available at https://day.js.org/en/

Related PR's:

@github-actions
Copy link

github-actions bot commented Jan 5, 2024

Jest Unit Test Statistics

       1 files  ±0     193 suites  ±0   8m 8s ⏱️ -6s
1 090 tests ±0     993 ✔️  - 30  2 💤 ±0  95 +30 
1 098 runs  ±0  1 000 ✔️  - 31  2 💤 ±0  96 +31 

For more details on these failures, see this check.

Results for commit f80e13a. ± Comparison against base commit 6578b6b.

♻️ This comment has been updated with latest results.

@JohnC-80 JohnC-80 requested a review from BogdanDenis February 12, 2024 16:34
Copy link
Contributor

@BogdanDenis BogdanDenis left a comment

Choose a reason for hiding this comment

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

Hey @JohnC-80, the PR looks good. I've added one commit to fix some import formatting

const packageRange = moment.range(packageBeginCoverageDate, packageEndCoverageDate);
const packageBeginCoverageDate = dayjs.utc(packageBeginCoverage);
const packageEndCoverageDate = packageEndCoverage ? dayjs.utc(packageEndCoverage) : dayjs.utc();
const packageRange = new DayRange(packageBeginCoverageDate, packageEndCoverageDate);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @JohnC-80 this is a very very belated review, apologies for that.
It looks like functions for moment.contains and dayjs.isBetween work differently.
moment returns true if we check dates that are either the beginning or end date, but dayjs will return false.
For example, for when checking if date 2021-01-01 is in range 2021-01-01 to 2021-01-31 moment will return true, but dayjs will return false.
The isBetween plugin has a parameter that defines if begin and end dates should or should not be included: https://day.js.org/docs/en/plugin/is-between

I think since we've been using moment and by default it includes start and end date then we should do the same with dayjs. Do you have any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am working on making this PR up-to-date so we can merge it, just need to confirm with you if we should make the date inclusivity a default behaviour or not

Copy link
Contributor

Choose a reason for hiding this comment

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

Created a PR to handle date ranges correctly folio-org/stripes-components#2443

@github-actions
Copy link

github-actions bot commented Mar 18, 2025

Jest Unit Test Results

    1 files  ±0    195 suites  ±0   4m 57s ⏱️ +15s
1 109 tests +2  1 106 ✅ +2  3 💤 ±0  0 ❌ ±0 
1 117 runs  +2  1 114 ✅ +2  3 💤 ±0  0 ❌ ±0 

Results for commit 9f041f4. ± Comparison against base commit 8f8548b.

This pull request removes 1 and adds 3 tests. Note that renamed tests count towards both.
Given EditCoverageSettings when setting incorrect coverage dates should show error message ‑ Given EditCoverageSettings when setting incorrect coverage dates should show error message
Given EditCoverageSettings when setting coverage dates are outside of package coverage dates should show error message ‑ Given EditCoverageSettings when setting coverage dates are outside of package coverage dates should show error message
Given EditCoverageSettings when setting coverage dates are within package coverage dates should show error message ‑ Given EditCoverageSettings when setting coverage dates are within package coverage dates should show error message
Given EditCoverageSettings when setting start coverage date after end coverage date should show error message ‑ Given EditCoverageSettings when setting start coverage date after end coverage date should show error message

♻️ This comment has been updated with latest results.

@OleksandrHladchenko1 OleksandrHladchenko1 self-requested a review March 20, 2025 09:42
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
77.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@BogdanDenis BogdanDenis marked this pull request as ready for review March 24, 2025 10:50
@BogdanDenis BogdanDenis merged commit b981d91 into master Mar 24, 2025
15 of 16 checks passed
@BogdanDenis BogdanDenis deleted the UIEH-1407 branch March 24, 2025 10:50
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