New issue
Advanced search Search tips

Issue 908892 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

remove moment.js dependency

Project Member Reported by seanmccullough@chromium.org, Nov 27

Issue description

Try to replace with Date#toLocaleDateString():
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

moment.js accounts for about 250k bytes
 
Strong support for removing moment.js. Some context that I think might be helpful: 

- I originally addeded moment.js for two features: timezone support (native JS only handles timezone support for the user's local timezone) and relative times (ie: 2 days ago) 
- Relative time can probably be replaced with a single ~100-200 line function, but there's a lot of cases to test for, which makes it kind of annoying. 
- The only timezone besides the user's timezone we really need is Pacific time, for timestamps that we want consistently displayed in MTV time. 
- chops-timestamp also uses moment.js, which we should definitely replace. This could be how we share a home-grown relative time library. 
- https://github.com/you-dont-need/You-Dont-Need-Momentjs for a relevant doc. 
Components: Infra>UI

Sign in to add a comment