moment#MomentInput TypeScript Examples

The following examples show how to use moment#MomentInput. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: moment-adapter.ts    From angular-material-components with MIT License 6 votes vote down vote up
/** Creates a Moment instance while respecting the current UTC settings. */
  private _createMoment(
    date: MomentInput,
    format?: MomentFormatSpecification,
    locale?: string,
  ): Moment {
    const { strict, useUtc }: NgxMatMomentDateAdapterOptions = this._options || {};

    return useUtc
      ? moment.utc(date, format, locale, strict)
      : moment(date, format, locale, strict);
  }
Example #2
Source File: moment-adapter.ts    From ngx-mat-datetime-picker with MIT License 6 votes vote down vote up
/** Creates a Moment instance while respecting the current UTC settings. */
  private _createMoment(
    date: MomentInput,
    format?: MomentFormatSpecification,
    locale?: string,
  ): Moment {
    const { strict, useUtc }: NgxMatMomentDateAdapterOptions = this._options || {};

    return useUtc
      ? moment.utc(date, format, locale, strict)
      : moment(date, format, locale, strict);
  }
Example #3
Source File: moment_wrapper.ts    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
toUtc = (input?: DateTimeInput, formatInput?: FormatInput): DateTime => {
  return moment.utc(input as MomentInput, formatInput) as DateTime;
}
Example #4
Source File: moment_wrapper.ts    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
dateTime = (input?: DateTimeInput, formatInput?: FormatInput): DateTime => {
  return moment(input as MomentInput, formatInput) as DateTime;
}