devshawn / react-dayjs Goto Github PK
View Code? Open in Web Editor NEW⏰ React component for the dayjs date library.
License: Other
⏰ React component for the dayjs date library.
License: Other
I would be helpful for both contributors and developers who use this repo if it has example app.
I received the following error whilst attempting to install via npm:
ERESOLVE unable to resolve dependency tree
While resolving: [email protected]
Found: [email protected]
node_modules/react
react@"^18.2.0" from the root project
Could not resolve dependency:
peer react@"^15.6.0 || ^16.0.0 || ^17.0.0" from [email protected]
node_modules/react-dayjs
react-dayjs@"*" from the root project
Am I correct in assuming that this is because DayJs has yet to be marked as compatible with React v18?
When trying to update the dayjs package with $npm update , the following message is produced from npm
$ npm update
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.6.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-dayjs
npm ERR! react-dayjs@"^0.2.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
this what $npm outdated produced
$ npm outdated
Package Current Wanted Latest Location Depended
by
@testing-library/jest-dom 5.11.6 5.11.9 5.11.9 node_modules/@testing-library/jest-dom client
@testing-library/react 11.2.2 11.2.3 11.2.3 node_modules/@testing-library/react client
@testing-library/user-event 12.5.0 12.6.0 12.6.0 node_modules/@testing-library/user-event client
axios 0.21.0 0.21.1 0.21.1 node_modules/axios client
dayjs 1.9.7 1.10.3 1.10.3 node_modules/dayjs client
web-vitals 0.2.4 0.2.4 1.1.0 node_modules/web-vitals client
something similar had happened more than a month ago when I was installing dayjs and initiating this project
It looks as if the release was not packaged correctly:
error: Error: While trying to resolve module `react-dayjs` from file `/home/user/project/SomeFile.js`, the package `/home/user/project/node_modules/react-dayjs/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/home/user/project/node_modules/react-dayjs/dist/index.js`. Indeed, none of these files exist:
* /home/user/project/node_modules/react-dayjs/dist/index.js(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* /home/user/project/node_modules/react-dayjs/dist/index.js/index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
I think it is because of webpack
which seemes to be used in this project
Hey,
I have to use this with react 17.0.1. I have also found that dayjs reports 2 vulnerabilities.
So, I have forked your repo and fixed the problems (upgrade branch) and all the tests still pass (at least, I didn't break any more -- the linter is complaining about state hoisting). It's easy enough for you to fix yourself, or I could issue a pull request if you like.
Bryan
This currently uses babel 6 for building. It should be updated to use babel 7 and the newer babel plugins (that start with @babel/...
) over the older versions.
This is a good first issue for someone who wants to give it a shot!
I would expect to see updated value when the date has been changed
Lines 127 to 129 in 48e295c
I noticed that react-dayjs does not provide proper type support, which can lead to potential issues and lack of type safety in TypeScript projects. This issue addresses the missing type support and enhances the developer experience when using react-dayjs with TypeScript.
Currently, when using react-dayjs in a TypeScript project, the type information for the components and utility functions is not available or incomplete. This makes it challenging to leverage the full benefits of TypeScript, such as autocompletion, type checking, and improved code documentation.
It would be great to have complete and accurate type definitions for all the components, props, and utility functions provided by react-dayjs. This would enable TypeScript developers to write more reliable code and catch errors during development rather than runtime.
When using react-dayjs in a TypeScript project, the type definitions for all the components, props, and utility functions should be provided, allowing developers to benefit from TypeScript's static typing capabilities. This includes accurate prop typings, return types, and any additional type information necessary to ensure type safety.
Currently, react-dayjs does not provide comprehensive type support, leading to a lack of type safety and hindered development experience for TypeScript users. The existing type definitions are either missing, incomplete, or inaccurate, making it difficult to leverage TypeScript's features effectively.
One possible solution is to update the react-dayjs package to include complete and accurate type definitions for all the exposed entities. This can be achieved by utilizing TypeScript declaration files (.d.ts) or TypeScript interfaces.
Alternatively, if the maintainers prefer community contributions, providing guidelines on how to contribute type definitions would be beneficial. This would allow TypeScript developers to contribute and maintain the type support for react-dayjs.
Type support is crucial for projects using TypeScript as it helps catch potential errors during development and improves the overall stability and maintainability of the codebase. By addressing the missing type support in react-dayjs, we can enhance the experience for TypeScript users and attract a wider range of developers to use and contribute to the project.
Please let me know if you need any further assistance or if there are any specific details you would like to add to the title or description!
The main
property in package.json
points to dist/index.js. However dist/index.js
is not bundled on NPM, so if you install react-dayjs via NPM and try to load it, it fails. Either bundle dist/index.js
or point main
to source/index.jsx
The example
project showcasing how to use react-dayjs
has not been updated in awhile. Many dependencies are out of date and include security vulnerabilities. This is a great first issue for someone to take on. 😄
Error code as generated by vs code:
"
Could not find a declaration file for module 'react-dayjs'. 'C:/Users/User/{project}/node_modules/react-dayjs/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/react-dayjs
if it exists or add a new declaration (.d.ts) file containing declare module 'react-dayjs';
"
react-moment offers the possibility to hand all unknown props to the element
(see here). For example styles can be handed to a <Text>
. It doesn't look like much work to implement this.
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.