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

[2.x] Inertia: Remove moment.js dependency #561

Merged
merged 5 commits into from
Dec 23, 2020
Merged

[2.x] Inertia: Remove moment.js dependency #561

merged 5 commits into from
Dec 23, 2020

Conversation

claudiodekker
Copy link
Contributor

@claudiodekker claudiodekker commented Dec 23, 2020

While cleaning up the app.js, I noticed that the moment library was included, but was only being used once.

Because Inertia gets it's state from the back-end, we can instead let Carbon do this conversion for us and pass it through to the front-end and remove the (fairly large) moment dependency entirely.

@claudiodekker claudiodekker changed the title Inertia: Removes moment.js dependency Inertia: Remove moment.js dependency Dec 23, 2020
@claudiodekker claudiodekker changed the title Inertia: Remove moment.js dependency [2.x] Inertia: Remove moment.js dependency Dec 23, 2020
@reinink
Copy link
Contributor

reinink commented Dec 23, 2020

Love this change, simply because Moment.js is huge. I personally removed it from my own SaaS app recently for the same reason. Read more about the issues with Momment here.

This line was going to cause a merge conflict anyway, so I figured I might as well just re-introduced the i18n translation to not have the two PR's overflow.
@taylorotwell
Copy link
Member

One benefit of using Moment is the ability to use the user's local browser timezone when rendering / manipulating dates. Does this still display accurately?

@reinink
Copy link
Contributor

reinink commented Dec 23, 2020

@taylorotwell Great point, I don't think this does. Let us investigate. 👍

@claudiodekker
Copy link
Contributor Author

claudiodekker commented Dec 23, 2020

@taylorotwell I don't think it'd matter in this case.. The server stores it's server-side timestamp in the database, and on retrieval it'd diff against the server-side time at that point, so wouldn't the outcome always be identical regardless?:

Screenshot 2020-12-23 at 14 59 57

Or am I overlooking something / misunderstanding?

@reinink
Copy link
Contributor

reinink commented Dec 23, 2020

@claudiodekker Yup, you're right. Since the diff is done between two UTC dates, you'll end up with identical results either way. Good catch. 👍

@taylorotwell taylorotwell merged commit 1059035 into laravel:master Dec 23, 2020
@claudiodekker claudiodekker deleted the inertia-remove-momentjs branch December 23, 2020 14:09
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

Successfully merging this pull request may close these issues.

None yet

3 participants