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

Chore/migrate-time-libraries #61

Open
khinshankhan opened this issue Nov 7, 2020 · 2 comments
Open

Chore/migrate-time-libraries #61

khinshankhan opened this issue Nov 7, 2020 · 2 comments

Comments

@khinshankhan
Copy link
Collaborator

khinshankhan commented Nov 7, 2020

Moment.js is done. It's highly recommended we migrate time libraries if only due to bundle size alone. It's not like we're using even half of moment.js's power at the moment, nor do we plan to.

Check out this cool proposal thought it's in stage 2 at the moment. Moment.js also recommends a few libraries here. date-fns is a pretty easy library to use, but we may be able to do our use cases with plain old Date() along with possibly Intl API as well.

@EdMaxPrime
Copy link
Collaborator

I read about this a month ago. I'm glad we're moving beyond polyfill JS libraries as more things are standardized.

For our site specifically, we want to decrease the bundle size cuz we don't use dates for anything after compilation. I wrapped the article's published date in a <time> tag, which hopefully the browser will convert automatically for international visitors, since its a semantic tag.

Idk how to migrate away from Moment if its a dependency?

@khinshankhan
Copy link
Collaborator Author

Oh btw, it should be

<time dateTime={edge.node.frontmatter.datetime}>
  {edge.node.frontmatter.humanDate}
</time>

datetime isn't used by react because of the camel case ideology. Here's an issue, you should see errors in the console 😱

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

No branches or pull requests

2 participants