ngx-moment

  • Version 6.0.2
  • Published
  • 185 kB
  • 1 dependency
  • MIT license

Install

npm i ngx-moment
yarn add ngx-moment
pnpm add ngx-moment

Overview

Moment.JS pipes for Angular (timeago and more)

Index

Variables

variable NGX_MOMENT_OPTIONS

const NGX_MOMENT_OPTIONS: InjectionToken<NgxMomentOptions>;

    Classes

    class AddPipe

    class AddPipe implements PipeTransform {}

      property ɵfac

      static ɵfac: i0.ɵɵFactoryDeclaration<AddPipe, never>;

        property ɵpipe

        static ɵpipe: i0.ɵɵPipeDeclaration<AddPipe, 'amAdd'>;

          method transform

          transform: (
          value: moment.MomentInput,
          amount: moment.DurationInputArg1,
          unit?: moment.DurationInputArg2
          ) => any;

            class CalendarPipe

            class CalendarPipe implements PipeTransform, OnDestroy {}

              constructor

              constructor(cdRef: ChangeDetectorRef, ngZone: NgZone);

                property ɵfac

                static ɵfac: i0.ɵɵFactoryDeclaration<CalendarPipe, never>;

                  property ɵpipe

                  static ɵpipe: i0.ɵɵPipeDeclaration<CalendarPipe, 'amCalendar'>;

                    method ngOnDestroy

                    ngOnDestroy: () => void;

                      method transform

                      transform: (value: moment.MomentInput, ...args: any[]) => any;

                        class DateFormatPipe

                        class DateFormatPipe implements PipeTransform {}

                          property ɵfac

                          static ɵfac: i0.ɵɵFactoryDeclaration<DateFormatPipe, never>;

                            property ɵpipe

                            static ɵpipe: i0.ɵɵPipeDeclaration<DateFormatPipe, 'amDateFormat'>;

                              method transform

                              transform: (value: moment.MomentInput, ...args: any[]) => string;

                                class DifferencePipe

                                class DifferencePipe implements PipeTransform {}

                                  property ɵfac

                                  static ɵfac: i0.ɵɵFactoryDeclaration<DifferencePipe, never>;

                                    property ɵpipe

                                    static ɵpipe: i0.ɵɵPipeDeclaration<DifferencePipe, 'amDifference'>;

                                      method transform

                                      transform: (
                                      value: moment.MomentInput,
                                      otherValue: moment.MomentInput,
                                      unit?: moment.unitOfTime.Diff,
                                      precision?: boolean
                                      ) => number;

                                        class DurationPipe

                                        class DurationPipe implements PipeTransform {}

                                          constructor

                                          constructor(momentOptions?: NgxMomentOptions);

                                            property allowedUnits

                                            allowedUnits: string[];

                                              property ɵfac

                                              static ɵfac: i0.ɵɵFactoryDeclaration<DurationPipe, [{ optional: true }]>;

                                                property ɵpipe

                                                static ɵpipe: i0.ɵɵPipeDeclaration<DurationPipe, 'amDuration'>;

                                                  method transform

                                                  transform: (value: moment.DurationInputArg1, ...args: string[]) => string;

                                                    class FromUnixPipe

                                                    class FromUnixPipe implements PipeTransform {}

                                                      property ɵfac

                                                      static ɵfac: i0.ɵɵFactoryDeclaration<FromUnixPipe, never>;

                                                        property ɵpipe

                                                        static ɵpipe: i0.ɵɵPipeDeclaration<FromUnixPipe, 'amFromUnix'>;

                                                          method transform

                                                          transform: (value: number | string, ...args: string[]) => any;

                                                            class FromUtcPipe

                                                            class FromUtcPipe implements PipeTransform {}

                                                              property ɵfac

                                                              static ɵfac: i0.ɵɵFactoryDeclaration<FromUtcPipe, never>;

                                                                property ɵpipe

                                                                static ɵpipe: i0.ɵɵPipeDeclaration<FromUtcPipe, 'amFromUtc'>;

                                                                  method transform

                                                                  transform: (
                                                                  value: moment.MomentInput,
                                                                  formats?: string | string[],
                                                                  ...args: string[]
                                                                  ) => any;

                                                                    class IsAfterPipe

                                                                    class IsAfterPipe implements PipeTransform {}

                                                                      property ɵfac

                                                                      static ɵfac: i0.ɵɵFactoryDeclaration<IsAfterPipe, never>;

                                                                        property ɵpipe

                                                                        static ɵpipe: i0.ɵɵPipeDeclaration<IsAfterPipe, 'amIsAfter'>;

                                                                          method transform

                                                                          transform: (
                                                                          value: moment.MomentInput,
                                                                          otherValue: moment.MomentInput,
                                                                          unit?: moment.unitOfTime.StartOf
                                                                          ) => boolean;

                                                                            class IsBeforePipe

                                                                            class IsBeforePipe implements PipeTransform {}

                                                                              property ɵfac

                                                                              static ɵfac: i0.ɵɵFactoryDeclaration<IsBeforePipe, never>;

                                                                                property ɵpipe

                                                                                static ɵpipe: i0.ɵɵPipeDeclaration<IsBeforePipe, 'amIsBefore'>;

                                                                                  method transform

                                                                                  transform: (
                                                                                  value: moment.MomentInput,
                                                                                  otherValue: moment.MomentInput,
                                                                                  unit?: moment.unitOfTime.StartOf
                                                                                  ) => boolean;

                                                                                    class LocalePipe

                                                                                    class LocalePipe implements PipeTransform {}

                                                                                      property ɵfac

                                                                                      static ɵfac: i0.ɵɵFactoryDeclaration<LocalePipe, never>;

                                                                                        property ɵpipe

                                                                                        static ɵpipe: i0.ɵɵPipeDeclaration<LocalePipe, 'amLocale'>;

                                                                                          method transform

                                                                                          transform: (value: moment.MomentInput, locale: string) => moment.Moment;

                                                                                            class LocalTimePipe

                                                                                            class LocalTimePipe implements PipeTransform {}

                                                                                              property ɵfac

                                                                                              static ɵfac: i0.ɵɵFactoryDeclaration<LocalTimePipe, never>;

                                                                                                property ɵpipe

                                                                                                static ɵpipe: i0.ɵɵPipeDeclaration<LocalTimePipe, 'amLocal'>;

                                                                                                  method transform

                                                                                                  transform: (value: moment.MomentInput) => moment.Moment;

                                                                                                    class MomentModule

                                                                                                    class MomentModule {}

                                                                                                      property ɵfac

                                                                                                      static ɵfac: i0.ɵɵFactoryDeclaration<MomentModule, never>;

                                                                                                        property ɵinj

                                                                                                        static ɵinj: i0.ɵɵInjectorDeclaration<MomentModule>;

                                                                                                          property ɵmod

                                                                                                          static ɵmod: i0.ɵɵNgModuleDeclaration<
                                                                                                          MomentModule,
                                                                                                          [
                                                                                                          typeof i1.AddPipe,
                                                                                                          typeof i2.CalendarPipe,
                                                                                                          typeof i3.DateFormatPipe,
                                                                                                          typeof i4.DifferencePipe,
                                                                                                          typeof i5.DurationPipe,
                                                                                                          typeof i6.FromUnixPipe,
                                                                                                          typeof i7.ParsePipe,
                                                                                                          typeof i8.SubtractPipe,
                                                                                                          typeof i9.TimeAgoPipe,
                                                                                                          typeof i10.UtcPipe,
                                                                                                          typeof i11.FromUtcPipe,
                                                                                                          typeof i12.LocalTimePipe,
                                                                                                          typeof i13.LocalePipe,
                                                                                                          typeof i14.ParseZonePipe,
                                                                                                          typeof i15.IsBeforePipe,
                                                                                                          typeof i16.IsAfterPipe
                                                                                                          ],
                                                                                                          never,
                                                                                                          [
                                                                                                          typeof i1.AddPipe,
                                                                                                          typeof i2.CalendarPipe,
                                                                                                          typeof i3.DateFormatPipe,
                                                                                                          typeof i4.DifferencePipe,
                                                                                                          typeof i5.DurationPipe,
                                                                                                          typeof i6.FromUnixPipe,
                                                                                                          typeof i7.ParsePipe,
                                                                                                          typeof i8.SubtractPipe,
                                                                                                          typeof i9.TimeAgoPipe,
                                                                                                          typeof i10.UtcPipe,
                                                                                                          typeof i11.FromUtcPipe,
                                                                                                          typeof i12.LocalTimePipe,
                                                                                                          typeof i13.LocalePipe,
                                                                                                          typeof i14.ParseZonePipe,
                                                                                                          typeof i15.IsBeforePipe,
                                                                                                          typeof i16.IsAfterPipe
                                                                                                          ]
                                                                                                          >;

                                                                                                            method forRoot

                                                                                                            static forRoot: (
                                                                                                            options?: NgxMomentOptions
                                                                                                            ) => ModuleWithProviders<MomentModule>;

                                                                                                              class ParsePipe

                                                                                                              class ParsePipe implements PipeTransform {}

                                                                                                                property ɵfac

                                                                                                                static ɵfac: i0.ɵɵFactoryDeclaration<ParsePipe, never>;

                                                                                                                  property ɵpipe

                                                                                                                  static ɵpipe: i0.ɵɵPipeDeclaration<ParsePipe, 'amParse'>;

                                                                                                                    method transform

                                                                                                                    transform: (
                                                                                                                    value: moment.MomentInput,
                                                                                                                    formats: string | string[]
                                                                                                                    ) => moment.Moment;

                                                                                                                      class ParseZonePipe

                                                                                                                      class ParseZonePipe implements PipeTransform {}

                                                                                                                        property ɵfac

                                                                                                                        static ɵfac: i0.ɵɵFactoryDeclaration<ParseZonePipe, never>;

                                                                                                                          property ɵpipe

                                                                                                                          static ɵpipe: i0.ɵɵPipeDeclaration<ParseZonePipe, 'amParseZone'>;

                                                                                                                            method transform

                                                                                                                            transform: (value: moment.MomentInput) => moment.Moment;

                                                                                                                              class SubtractPipe

                                                                                                                              class SubtractPipe implements PipeTransform {}

                                                                                                                                property ɵfac

                                                                                                                                static ɵfac: i0.ɵɵFactoryDeclaration<SubtractPipe, never>;

                                                                                                                                  property ɵpipe

                                                                                                                                  static ɵpipe: i0.ɵɵPipeDeclaration<SubtractPipe, 'amSubtract'>;

                                                                                                                                    method transform

                                                                                                                                    transform: (
                                                                                                                                    value: moment.MomentInput,
                                                                                                                                    amount: moment.DurationInputArg1,
                                                                                                                                    unit?: moment.DurationInputArg2
                                                                                                                                    ) => any;

                                                                                                                                      class TimeAgoPipe

                                                                                                                                      class TimeAgoPipe implements PipeTransform, OnDestroy {}

                                                                                                                                        constructor

                                                                                                                                        constructor(cdRef: ChangeDetectorRef, ngZone: NgZone);

                                                                                                                                          property ɵfac

                                                                                                                                          static ɵfac: i0.ɵɵFactoryDeclaration<TimeAgoPipe, never>;

                                                                                                                                            property ɵpipe

                                                                                                                                            static ɵpipe: i0.ɵɵPipeDeclaration<TimeAgoPipe, 'amTimeAgo'>;

                                                                                                                                              method format

                                                                                                                                              format: (m: moment.Moment) => string;

                                                                                                                                                method ngOnDestroy

                                                                                                                                                ngOnDestroy: () => void;

                                                                                                                                                  method transform

                                                                                                                                                  transform: (
                                                                                                                                                  value: moment.MomentInput,
                                                                                                                                                  omitSuffix?: boolean,
                                                                                                                                                  formatFn?: (m: moment.Moment) => string
                                                                                                                                                  ) => string;

                                                                                                                                                    class UtcPipe

                                                                                                                                                    class UtcPipe implements PipeTransform {}

                                                                                                                                                      property ɵfac

                                                                                                                                                      static ɵfac: i0.ɵɵFactoryDeclaration<UtcPipe, never>;

                                                                                                                                                        property ɵpipe

                                                                                                                                                        static ɵpipe: i0.ɵɵPipeDeclaration<UtcPipe, 'amUtc'>;

                                                                                                                                                          method transform

                                                                                                                                                          transform: (value: moment.MomentInput) => moment.Moment;

                                                                                                                                                            Interfaces

                                                                                                                                                            interface NgxMomentOptions

                                                                                                                                                            interface NgxMomentOptions {}

                                                                                                                                                              property relativeTimeThresholdOptions

                                                                                                                                                              relativeTimeThresholdOptions: {
                                                                                                                                                              [key: string]: number;
                                                                                                                                                              };
                                                                                                                                                              • relativeTimeThresholdOptions Provides the relativeTimeThreshold units allowing a pipe to set the moment.relativeTimeThreshold values. The key is a unit defined as one of ss, s, m, h, d, M.

                                                                                                                                                                Example 1

                                                                                                                                                                by default more than 45 seconds is considered a minute, more than 22 hours is considered a day and so on. So settings the unit 'm' to 59 will adjust the relativeTimeThreshold and consider more than 59 minutes to be an hour (default is 45 minutes)

                                                                                                                                                                See Also

                                                                                                                                                                • https://momentjs.com/docs/#/customization/relative-time-threshold/

                                                                                                                                                              Package Files (19)

                                                                                                                                                              Dependencies (1)

                                                                                                                                                              Dev Dependencies (0)

                                                                                                                                                              No dev dependencies.

                                                                                                                                                              Peer Dependencies (1)

                                                                                                                                                              Badge

                                                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ngx-moment.

                                                                                                                                                              • Markdown
                                                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ngx-moment)
                                                                                                                                                              • HTML
                                                                                                                                                                <a href="https://www.jsdocs.io/package/ngx-moment"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>