Bug 571807 - Use localeCompare() with numeric option to sort categories. r=darktrojan
authorsrujana <srujana.peddinti@students.iiit.ac.in>
Fri, 22 Mar 2019 22:06:15 +0100
changeset 26147 3e648008d386
parent 26146 1aba8edbbfa2
child 26148 3496ec1acebe
push id15696
push usermozilla@jorgk.com
push dateSat, 23 Mar 2019 08:18:55 +0000
treeherdercomm-central@34cf7d8564ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs571807
Bug 571807 - Use localeCompare() with numeric option to sort categories. r=darktrojan
calendar/base/modules/utils/calUnifinderUtils.jsm
--- a/calendar/base/modules/utils/calUnifinderUtils.jsm
+++ b/calendar/base/modules/utils/calUnifinderUtils.jsm
@@ -189,18 +189,17 @@ const sortCompare = calunifinder.sortEnt
     string: function(a, b, modifier=1) {
         if (a.length == 0 || b.length == 0) {
             // sort empty values to end (so when users first sort by a
             // column, they can see and find the desired values in that
             // column without scrolling past all the empty values).
             return -(a.length - b.length) * modifier;
         }
 
-        let collator = cal.l10n.createLocaleCollator();
-        return collator.compareString(0, a, b) * modifier;
+        return a.localeCompare(b, undefined, { numeric: true }) * modifier;
     },
 
     /**
      * Catch-all function to compare two unknown values. Will return 0.
      *
      * @param {*} a                 The first thing to compare
      * @param {*} b                 The second thing to compare
      * @param {Number} modifier     Provided for consistency, but unused