-
Notifications
You must be signed in to change notification settings - Fork 4
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 totally reusable component using moment library #40
Comments
Is it just for rendering a date, or does it do more? |
I think that a component will only make sense when we're rendering something... We have this one that's a wrapper for |
Not, the real intention here it's to works with date through props. But, with that, We'll gonna need a parser where we could export too. Like bellow: import Date from '@entria/components/Date';
// we can too export a helper for works with date ;) but this, would be only a abstraction from moment
// for example, this helper could named `parseDate`, whatever
import { parseDate } from '@entria/components/Date';
// for date rendering
<Date date={date} />
// or with children (because we can take the children like string and work it)
<Date>{date}</Date>
<Date>{new Date()}</Date> // could be rendering too
// this way, the full prop would be default
<Date>26/10</Date> // could be rendering too
<Date month>26/10</Date> // like that, would render only 10
// but on my think this will gonna helps with examples bellow
// rendering only month in date
<Date month date={date} />
<Date year date={date} />
<Date full date={date} /> There's a lot of possibilities! 🎉 |
@felippepuhle we can reuse this like a helper and haves a component for that! Of course, we need first improve this helper. |
@felippepuhle moment it's better than |
But I'm thinking that |
Feel free to send a PR implementing this guy on I don't think that's a good idea use both of them( |
If this it's solving your issues, so this seems be a good idea. But, take a look so on moment project, because I really believe that you'll gonna see than moment lib can safe better the javascript using dates, for a lot of reasons, but take your own, reading it hahaha |
With a React component for that we can grow up our possibilities. Think it! @alexandref93 @felippepuhle |
<Date />
Why we not haves a Date component where him it's working nicely with dates where on javascript it's so hard works?
What u think about guys?
This point makes sense?
The text was updated successfully, but these errors were encountered: