function convertFormatToMask(format) {
  return format
  // Long month replacement.
    .replace(/M{4}/g, 'MM')
    // Initial short month conversion.
    .replace(/M{3}/g, '***')
    // Short month conversion if input as text.
    .replace(/e/g, 'Q')
    // Month number conversion.
    .replace(/W/g, '99')
    // Year conversion.
    .replace(/[ydhmswHMG]/g, '9')
    // AM/PM conversion.
    .replace(/a/g, 'AA');
}
Convert the format from the angular-datepicker module to mask format.
@param {string} format - The format to convert.
@returns {string} - The converted format.