• Robert Knight's avatar
    Refactor date/timestamp formatting utilities · a2ddc566
    Robert Knight authored
     - Combine `sidebar/util/date.js` and `sidebar/util/time.js`. It was
       confusing to have two separate modules when there wasn't a clear
       separation of "time utilities" vs "date utilities". This also
       eliminates some redundant caching logic.
    
     - Rename `toFuzzyString` and `format` to `formatRelativeDate` and
       `formatDate` respectively to make the differnce between them more
       obvious
    
     - Add missing test for `formatDate`
    
     - Remove the fallback code paths for old browsers that don't support
       `Intl.DateTimeFormat`. All of our currently supported browsers do.
    
     - Remove unused `date` parameter from `decayingInterval` callback. The
       only consumer in `AnnotationTimestamps` didn't use it.
    
     - Improve types in `time.js`
    a2ddc566
AnnotationTimestamps-test.js 3.08 KB