Exemplo n.º 1
0
 return options.filter(option => {
   const format = getDateFormatFromStyle(option.value, unit);
   if (seen.has(format)) {
     return false;
   } else {
     seen.add(format);
     return true;
   }
 });
Exemplo n.º 2
0
function dateStyleOption(
  style: DateStyle,
  unit: ?DatetimeUnit,
  description?: ?string,
) {
  const format = getDateFormatFromStyle(style, unit);
  return {
    name:
      EXAMPLE_DATE.format(format) + (description ? ` (${description})` : ``),
    value: style,
  };
}
Exemplo n.º 3
0
function dateStyleOption(
  style: DateStyle,
  unit: ?DatetimeUnit,
  description?: ?string,
  abbreviate?: boolean = false,
  separator?: string,
) {
  let format = getDateFormatFromStyle(style, unit, separator);
  if (abbreviate) {
    format = format.replace(/MMMM/, "MMM").replace(/dddd/, "ddd");
  }
  return {
    name:
      EXAMPLE_DATE.format(format) + (description ? ` (${description})` : ``),
    value: style,
  };
}
Exemplo n.º 4
0
 getHidden: ({ unit }: Column, settings: ColumnSettings) => {
   const format = getDateFormatFromStyle(settings["date_style"], unit);
   return !format.match(/MMMM|dddd/);
 },