hshoff / era Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://hshoff.dev/calendar
License: MIT License
Home Page: https://hshoff.dev/calendar
License: MIT License
Thank you for creating a wonderful calendar library.
It is very helpful.
Currently, the test does not pass in my environment.
$ yarn test
...
...
...
viewOfInterval()
✓ returns a day interval for day view (2ms)
✓ returns a week interval for week view (2ms)
✕ returns a month interval for month view (7ms)
✓ returns a year interval for year view (30ms)
viewOfDays()
✕ returns day intervals for view and datetime (5ms)
...
...
...
● viewOfInterval() › returns a month interval for month view
expect(received).toBe(expected) // Object.is equality
Expected: 31
Received: 42
87 | const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
88 | const interval = viewOfInterval(datetime, 'months');
> 89 | expect(numUnit(interval, 'days')).toBe(31);
| ^
90 | expect(interval.start.day).toBe(1);
91 | expect(interval.end.day).toBe(31);
92 | });
at Object.<anonymous> (test/calx.test.tsx:89:39)
● viewOfDays() › returns day intervals for view and datetime
expect(received).toBe(expected) // Object.is equality
Expected: 31
Received: 42
108 | const datetime = DateTime.fromObject({ year: 2019, month: 12, day: 30 });
109 | const days = viewOfDays(datetime, 'month');
> 110 | expect(days.length).toBe(31);
| ^
111 | expect(days[0].start.day).toBe(1);
112 | expect(days[30].start.day).toBe(31);
113 | });
at Object.<anonymous> (test/calx.test.tsx:110:25)
...
...
...
Test Suites: 1 failed, 1 total
Tests: 2 failed, 19 passed, 21 total
Snapshots: 0 total
Time: 2.416s, estimated 4s
After looking at the code, I have a few questions.
When do you need the logic for paddedMonthOf()
?
It's called in viewOfInterval()
, but monthOf(datetime)
looks fine to me. In fact, when I rewrote it to monthOf(datetime)
, the test passed.
Lines 108 to 109 in cc261df
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.