code: function localeFormat (d, format) {
          var tokens = format.match(/(%E.|%O.|%.)/g);
  
          for (var i = 0; tokens && i < tokens.length; i++) {
              var value = '';
  
              // http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html
              switch (tokens[i]) {
              // localized day/month names
              case '%a':
                  value = _('weekday-' + d.getDay() + '-short');
                  break;
              case '%A':
                  value = _('weekday-' + d.getDay() + '-long');
                  break;
              case '%b':
              case '%h':
                  value = _('month-' + d.getMonth() + '-short');
                  break;
              case '%B':
                  value = _('month-' + d.getMonth() + '-long');
                  break;
              case '%Eb':
                  value = _('month-' + d.getMonth() + '-genitive');
                  break;
  
              // like %H, but in 12-hour format and without any leading zero
              case '%I':
                  value = d.getHours() % 12 || 12;
                  break;
  
              // like %d, without any leading zero
              case '%e':
                  value = d.getDate();
                  break;
  
              // %p: 12 hours format (AM/PM)
              case '%p':
                  value = d.getHours() < 12 ? _('time_am') : _('time_pm');
                  break;
  
              // localized date/time strings
              case '%c':
              case '%x':
              case '%X':
              // ensure the localized format string doesn't contain any %c|%x|%X
                  var tmp = _('dateTimeFormat_' + tokens[i]);
                  if (tmp && !(/(%c|%x|%X)/).test(tmp)) {
                      value = localeFormat(d, tmp);
                  }
                  break;
  
              // other tokens don't require any localization
              }
  
              format = format.replace(tokens[i], value || d.toLocaleFormat(tokens[i]));
          }
  
          return format;
      }
docs: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleFormat