How to use the text-mask-addons/dist/createAutoCorrectedDatePipe function in text-mask-addons

To help you get started, we’ve selected a few text-mask-addons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instacart / Snacks / src / components / Forms / DateField.js View on Github external
import React from 'react'
import createAutoCorrectedDatePipe from 'text-mask-addons/dist/createAutoCorrectedDatePipe'
import omit from '../../utils/omit'
import MaskedTextField, { maskedTextFieldPropTypes } from './MaskedTextField'

const mask = [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/]
const hint = 'MM/DD/YYYY'
const pipe = createAutoCorrectedDatePipe('mm/dd/yyyy')

const getValue = value => value

export const dateFieldPropTypes = omit(
  maskedTextFieldPropTypes,
  'type',
  'mask',
  'maskHint',
  'pipe',
  'getValue',
  'ref'
)

class DateField extends React.Component {
  static propTypes = dateFieldPropTypes
github bullhorn / novo-elements / projects / novo-elements / src / elements / time-picker / TimePickerInput.ts View on Github external
ngOnInit(): void {
    this.placeholder = this.military ? this.labels.timeFormatPlaceholder24Hour : this.labels.timeFormatPlaceholderAM;
    this.maskOptions = {
      mask: this.military ? [/\d/, /\d/, ':', /\d/, /\d/] : [/\d/, /\d/, ':', /\d/, /\d/, ' ', /[aApP上下]/, /[mM午]/],
      pipe: this.military ? createAutoCorrectedDatePipe('HH:MM') : createAutoCorrectedDatePipe('mm:MM'),
      keepCharPositions: false,
      guide: true,
    };
  }
github bullhorn / novo-elements / projects / novo-elements / src / elements / date-picker / DatePickerInput.ts View on Github external
ngOnInit() {
    this.userDefinedFormat = this.format ? !this.format.match(/^(DD\/MM\/YYYY|MM\/DD\/YYYY)$/g) : false;
    if (!this.userDefinedFormat && this.textMaskEnabled && !this.allowInvalidDate) {
      this.maskOptions = this.maskOptions || {
        mask: this.dateFormatService.getDateMask(),
        pipe: createAutoCorrectedDatePipe(this.format || this.labels.dateFormatString().toLowerCase()),
        keepCharPositions: false,
        guide: true,
      };
    } else {
      this.maskOptions = { mask: false };
    }
  }
github bullhorn / novo-elements / src / platform / elements / time-picker / TimePickerInput.ts View on Github external
ngOnInit(): void {
    this.placeholder = this.military ? this.labels.timeFormatPlaceholder24Hour : this.labels.timeFormatPlaceholderAM;
    this.maskOptions = {
      mask: this.military ? [/\d/, /\d/, ':', /\d/, /\d/] : [/\d/, /\d/, ':', /\d/, /\d/, ' ', /[aApP]/, /[mM]/],
      pipe: this.military ? createAutoCorrectedDatePipe('HH:MM') : createAutoCorrectedDatePipe('mm:MM'),
      keepCharPositions: false,
      guide: true,
    };
  }
github Volst / ui-components / src / dataEntry / TimeInput.js View on Github external
render() {
    const { value } = this.props;
    const formatted = value ? value.format('HH:mm') : '';

    return (
      
    );
  }
}
github Volst / ui-components / src / dataEntry / SingleDatePicker.js View on Github external
render() {
    const dateFormat = this.context.inputDateFormat.toLowerCase();
    return (
      
    );
  }
}
github Volst / ui-components / src / dataEntry / TimeInput.tsx View on Github external
render() {
    const { value } = this.props;
    const formatted = value ? value.format('HH:mm') : '';

    return (
      
    );
  }
}
github GetTerminus / terminus-ui / terminus-ui / input / src / input.component.ts View on Github external
allowLeadingZeroes: true,
        }),
        unmaskRegex: allowDecimal ? NUMBER_WITH_DECIMAL_REGEX : NUMBER_ONLY_REGEX,
      },
      percentage: {
        mask: createNumberMask({
          prefix: '',
          suffix: '%',
          allowDecimal,
        }),
        unmaskRegex: allowDecimal ? NUMBER_WITH_DECIMAL_REGEX : NUMBER_ONLY_REGEX,
      },
      postal: { mask: this.determinePostalMask },
      date: {
        mask: [/\d/, /\d/, '-', /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
        pipe: createAutoCorrectedDatePipe(this.defaultDateFormat),
        keepCharPositions: false,
      },
      default: { mask: false },
    };
  }