Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date-fns v3 updates #18

Merged
merged 10 commits into from
Mar 26, 2024
Merged

date-fns v3 updates #18

merged 10 commits into from
Mar 26, 2024

Conversation

le-cong
Copy link
Contributor

@le-cong le-cong commented Mar 20, 2024

@le-cong le-cong added the MAJOR label Mar 20, 2024
@le-cong le-cong self-assigned this Mar 20, 2024
Copy link
Contributor

@carlansley carlansley left a comment

Choose a reason for hiding this comment

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

a few things. also, maybe we should resolve the test.ts/mts compilation issue before this goes out?

README.md Outdated

### Maintenance notes:

When update the latest code from the original repositories, except making all the necessary changes to make them fully typescript compatible, please remember to carry over the patches to overcoming the following issues:
Copy link
Contributor

Choose a reason for hiding this comment

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

update -> updating, overcoming -> overcome

README.md Outdated
- spring-forward support
- nanosecond support

please search for `[PATCH:]` in the existing codebase.
Copy link
Contributor

Choose a reason for hiding this comment

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

capital P

README.md Outdated

please search for `[PATCH:]` in the existing codebase.

The date-fns tests files are renamed from `test.ts` to `test.mts` so that they can be excluded from being processed by builder bundling. It's a workaround until better approach is available to have a unified control over both regular compilation and bundling.
Copy link
Contributor

Choose a reason for hiding this comment

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

...until a better approach is available to have unified control...

case 'PPP':
return formatLong.date({ width: 'long' });
case 'PPPP':
case "P":
Copy link
Contributor

Choose a reason for hiding this comment

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

should we apply our prettier formatting? most of the changes in this file are just formatting changes

@le-cong
Copy link
Contributor Author

le-cong commented Mar 21, 2024

a few things. also, maybe we should resolve the test.ts/mts compilation issue before this goes out?

my reason for not doing type checking for date-fns's tests are:

  • it's 3rd party source code and the typing errors are massive, it's both complex and time consuming if not impossible.
  • we do run all those tests using vitest to make sure that everything essentially works.

what do you think?

@le-cong le-cong requested a review from carlansley March 21, 2024 19:20
Copy link
Contributor

@ramaghanta ramaghanta left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

Coverage after merging date-fns-v3 into main will be

59.19%▾ -1.44%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   format-utc.ts100%100%100%100%
   index.ts100%100%100%100%
   instant.ts100%100%100%100%
   now.ts100%100%100%100%
   temporal.ts100%100%100%100%
src/date-fns
   index.ts100%100%100%100%
   types.ts0%0%0%0%1, 1, 10, 100–109, 11, 110–119, 12, 120–129, 13, 130–139, 14, 140–149, 15, 150–159, 16, 160–169, 17, 170–179, 18, 180–189, 19, 190–199, 2, 20, 200–209, 21, 210–219, 22, 220–229, 23, 230–239, 24, 240–249, 25, 250–259, 26, 260–269, 27, 270–279, 28, 280–289, 29, 290–299, 3, 30, 300–303, 31–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70–79, 8, 80–89, 9, 90–99
src/date-fns-tz
   index.ts100%100%100%100%
   types.ts0%0%0%0%1, 1, 10–14, 2–9
src/date-fns-tz/_lib/newDateUTC
   index.ts100%100%100%100%
src/date-fns-tz/_lib/tzIntlTimeZoneName
   index.ts26.09%100%0%27.91%10–15, 17–25, 29–43, 9
src/date-fns-tz/_lib/tzParseTimezone
   index.ts52.38%37.50%50%54.11%101, 105–130, 132–134, 143–145, 20–22, 26–28, 34–42, 46–56, 60–61, 65, 69, 69–71, 73–83
src/date-fns-tz/_lib/tzPattern
   index.ts100%100%100%100%
src/date-fns-tz/_lib/tzTokenizeDate
   index.ts82.42%75%100%82.50%30–35, 58–67
src/date-fns-tz/date-fns-v2-lib/assign
   index.ts7.14%100%0%7.69%10–13, 2–9
src/date-fns-tz/date-fns-v2-lib/cloneObject
   index.ts50%100%0%60%4–5
src/date-fns-tz/format
   index.ts96.90%50%100%97.70%324, 335, 335–343
src/date-fns-tz/format/formatters
   index.ts16.57%100%0%17.47%10, 100–109, 11, 110–114, 118–119, 12, 120–126, 128–129, 13, 130–135, 137–139, 14, 140–144, 146–149, 15, 150–152, 154–159, 16, 160–164, 17–39, 44–70, 75–89, 9, 90–92, 97–99
src/date-fns-tz/formatInTimeZone
   index.ts73.68%100%0%75.68%29–37
src/date-fns-tz/getTimezoneOffset
   index.ts90.91%100%0%93.75%31–32
src/date-fns-tz/toDate
   index.ts25.92%20%9.09%26.47%103–104, 108–153, 156–186, 188–218, 220–308, 310–356, 358–367, 374–376, 378–398, 400–414, 416–426, 428–442, 86–88, 90–92, 96–97, 97, 97–99
src/date-fns-tz/utcToZonedTime
   index.ts100%100%100%100%
src/date-fns-tz/zonedTimeToUtc
   index.ts58.18%100%0%59.26%33–54
src/date-fns/_lib/addLeadingZeros
   index.ts87.50%50%100%100%2
src/date-fns/_lib/defaultLocale
   index.ts100%100%100%100%
src/date-fns/_lib/defaultOptions
   index.ts81.25%100%50%84.62%12–13
src/date-fns/_lib/format/formatters
   index.ts32.63%40%22.22%32.91%100, 106–111, 118–134, 139–142, 155–156, 161–191, 196–226, 233, 237–238, 240–244, 246–250, 252–254, 260–287, 292–298, 303–309, 314–316, 323–329, 334–363, 368–404, 409–445, 450–487, 492–520, 525–560, 565–596, 601–605, 612–614, 621–627, 632–639, 644–646, 653–655, 667–692, 697–718, 723–735, 740–752, 757–758, 763–764, 768–777, 779–785, 787–793, 86–99
src/date-fns/_lib/format/lightFormatters
   index.ts80.33%57.14%88.89%82.83%30–31, 37, 47–63, 69, 69, 77
src/date-fns/_lib/format/longFormatters
   index.ts19.72%100%0%20.59%10–17, 20–31, 34–59, 6, 60–63, 7–9
src/date-fns/_lib/getRoundingMethod
   index.ts27.27%100%0%30%10, 4–9
src/date-fns/_lib/getTimezoneOffsetInMilliseconds
   index.ts46.67%100%0%48.28%15–29
src/date-fns/_lib/protectedTokens
   index.ts65.52%100%50%65.22%15–18, 20–23
src/date-fns/_lib/test
   index.ts0%0%0%0%1, 1, 10–19, 2, 20–29, 3–9
src/date-fns/_test/dst
   tzOffsetTransitions.ts0%0%0%0%1, 1, 10, 100–109, 11, 110–119, 12, 120–129, 13, 130–139, 14, 140, 15–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–59, 6, 60–69, 7, 70–79, 8, 80–89, 9, 90–99
src/date-fns/_test/dst/addBusinessDays
   basic.ts0%0%0%0%1, 1, 10–17, 2–9
src/date-fns/_test/dst/eachDayOfInterval
   basic.ts0%0%0%0%1, 1, 10–19, 2, 20–21, 3–9
src/date-fns/_test/dst/formatDistanceStrict
   cairo.ts0%0%0%0%1, 1–8
   melbourne.ts0%0%0%0%1, 1, 10–12, 2–9
src/date-fns/_test/dst/getOverlappingDaysInIntervals
   basic.ts0%0%0%0%1, 1, 10–16, 2–9
src/date-fns/_test/dst/parseISO
   basic.ts0%0%0%0%1, 1, 10–19, 2, 20–23, 3–9
   samoa.ts0%0%0%0%1, 1, 10–12, 2–9
   sydney.ts0%0%0%0%1, 1, 10–19, 2, 20–29, 3, 30–39, 4, 40–49, 5, 50–57, 6–9
src/date-fns/_test/formatISO
   india.ts0%0%0%0%1, 1–9
src/date-fns/_test/formatRFC3339
   australia.ts0%0%0%0%1, 1, 10–19, 2, 20, 3–9
   india.ts0%0%0%0%1, 1, 10–19, 2, 20, 3–9
   newfoundland.ts0%0%0%0%1, 1, 10–19, 2, 20–21, 3–9
   newzealand.ts0%0%0%0%1, 1, 10–19, 2, 20–21, 3–9
   poland.ts0%0%0%0%1, 1, 10–19, 2, 20, 3–9
src/date-fns/add
   index.ts94.29%20%100%100%52, 52, 55, 55
src/date-fns/addBusinessDays
   index.ts42.86%100%0%43.55%28–62
src/date-fns/addDays
   index.ts86.49%33.33%100%90.91%26–30
src/date-fns/addHours
   index.ts88.89%100%0%92.31%25–26
src/date-fns/addISOWeekYears
   index.ts89.66%100%0%92.86%27–28
src/date-fns/addMilliseconds
   index.ts85.71%100%0%88.89%25–27
src/date-fns/addMinutes
   index.ts88.89%100%0%92.31%25–26
src/date-fns/addMonths
   index.ts86.76%25%100%90.48%30–34, 48–51
src/date-fns/addQuarters
   index.ts85.19%100%0%88.46%24–26
src/date-fns/addSeconds
   index.ts88.46%100%0%92%24–25
src/date-fns/addWeeks
   

Copy link

Beta Published - Install Command: npm install @checkdigit/[email protected]

Copy link

✅ PR review status - All reviews completed and approved!

@le-cong le-cong merged commit 0c7bbd8 into main Mar 26, 2024
9 checks passed
@le-cong le-cong deleted the date-fns-v3 branch March 26, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update to the latest version of date-fns (3.x.x)
3 participants