code: function formatDate(value, format, locale, timezone) {
      var date = toDate(value);
      var namedFormat = getNamedFormat(locale, format);
      format = namedFormat || format;
      var parts = [];
      var match;
      while (format) {
          match = DATE_FORMATS_SPLIT.exec(format);
          if (match) {
              parts = parts.concat(match.slice(1));
              var part = parts.pop();
              if (!part) {
                  break;
              }
              format = part;
          }
          else {
              parts.push(format);
              break;
          }
      }
      var dateTimezoneOffset = date.getTimezoneOffset();
      if (timezone) {
          dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
          date = convertTimezoneToLocal(date, timezone, true);
      }
      var text = '';
      parts.forEach(function (value) {
          var dateFormatter = getDateFormatter(value);
          text += dateFormatter ?
              dateFormatter(date, locale, dateTimezoneOffset) :
              value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
      });
      return text;
  }
docs: @ngModule CommonModule
  @description
  
  Formats a date according to locale rules.
  
  Where:
  - `value` is a Date, a number (milliseconds since UTC epoch) or an ISO string
  (https://www.w3.org/TR/NOTE-datetime).
  - `format` indicates which date/time components to include. See {@link DatePipe} for more
  details.
  - `locale` is a `string` defining the locale to use.
  - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
  abbreviations, but for general use, use a time zone offset (e.g. `'+0430'`).
  If not specified, host system settings are used.
  
  See {@link DatePipe} for more details.