Questions tagged [angular2-moment]

Angular2 moment provides pipes for using momentjs methods in the angular environment. Make sure to include momentjs and angular tags along with this tag. Use angular-moment tag for the angularjs version of the library.

angular2 moment is a plugin that adds the following pipes to Angular based on the moment.js library.

  • Pipes
    • amTimeAgo - Use to format relative time
    • amCalendar - Format a date using moment.js calendar() method
    • amDateFormat - Format a date using moment.js format() method
    • amParse - Parse a custom-formatted date into a moment object
    • amFromUnix - Convert a unix-timestamp into a moment object
    • amDuration - Format a duration in a human readable format
    • amDifference - Get the difference between two dates in milliseconds
    • amAdd - Add hours, minutes or seconds from the specified date.
    • amSubtract - Subtract hours, minutes or seconds from the specified date.
    • amUtc - Create or switch the current moment object into UTC mode

References

Related Tags

46 questions
0
votes
1 answer

angular moment time difference calculation error

I'm trying to calculate the difference in time between NOW and a time in the past. I won't go too in depth here as far as how my web system (by API) works, but essentially I am returning an array of publication times. What I want to achieve: NOW…
dataviews
  • 2,466
  • 7
  • 31
  • 64
0
votes
0 answers

Set timezone globally in Angular 6

I'm building my first project in Angular 6 using Redux. In my last projects I used AngularJS, where I imported moment Library and, after the user logged in, I set the default timezone: moment.tz.setDefault("UTC"); I need the same behaviour in my…
panagulis72
  • 2,129
  • 6
  • 31
  • 71
0
votes
0 answers

How to exclude locale from anguar2-moment?

In my ionic-angular application I am using angular2-moment. When lookin at the source maps It includes locales which in turn increases the size of my vendor.js I want to exclude locale, how to do this ? I have followed this link in which…
Aditya
  • 2,358
  • 6
  • 35
  • 61
0
votes
1 answer

How to display the time as 1 mins ago using angular2-moment

{{2018-04-16T05:56:45.200Z | amTimeAgo}}
The above gives me results after a minute as 1 minutes ago but I want the result as 1 mins ago How can I achieve this using angular2-moment npm module? I have to use this module only to fulfill…
Aditya
  • 2,358
  • 6
  • 35
  • 61
0
votes
1 answer

Angular2-moment, MongoDB UTC time

I want to display just the date as Jun 29, 1967 - but it is coming back to my angular app as 1967-06-28 19:00:00.000 - so it is naturally displaying June 28, 1967. My HTML form date selector - selected : 06/29/1967 The form is submitted... MongoDB…
j-p
  • 3,698
  • 9
  • 50
  • 93
0
votes
0 answers

Certain modules cause the "Can't resolve all parameters" error?

I've noticed that some modules will cause my Angular 5 app to show the "can't resolve all parameters" error: EXCEPTION: Can't resolve all parameters for ApiService: (?). I'd recently encountered this problem through other means and solved it by…
nonexistent
  • 539
  • 5
  • 14
0
votes
1 answer

Retrieve specific data by date with Angular and moment.js

I have a database structure like these (Firebase): + statistics |-+ 2016 | |-+ 9 | |-+ hours: 0 |-+ 2017 |-+ 6 | |-+ hours: 0 |-+ 7 |-+ 8 |-+ 9 The parents are years, the childs are months (9 for example is September) It´s easy to…
Vueer
  • 1,432
  • 3
  • 21
  • 57
0
votes
1 answer

Parse UTC date time with angular-moment2

I have basically a date '2017-08-03T05:46:35.046328Z' & I want to parse this using angular 2 - moment in this format 'MM/DD/YYYY 12.00AM/PM.
0
votes
1 answer

How to use TimeAgoPipe of MomentModule from typescript file in angular 2

I want to use moment.js for displaying the age of a marker shown in google map in my ionic 2 app. I have installed moment.js as npm install --save angular2-moment The doc of angular2-moment explains how to use amTimeAgo from template. But I…
Dijish U.K
  • 159
  • 1
  • 22
0
votes
2 answers

Angular2-moment, format minutes to

These are minutes : 1956 I want to format these minutes to : HH:mm I'm using angular2-moment. I've tried : 1956 | amDuration:'minutes' | amDateFormat: 'HH:mm' But I get "Invalid date" What do i have to do to make it work ?
Swarovski
  • 581
  • 2
  • 8
  • 25
0
votes
0 answers

How to Format Time in Angular

I have a component in which i show edited by . Edited before Prsently i am using Angular 2 Moment for the same/ But the…
Rahul
  • 427
  • 3
  • 7
  • 16
0
votes
1 answer

How to set a class attribute in TypeScript as a Moment type?

I'm able to use moment.JS and all of the methods, but I want to set an attribute in my class to be a type Moment, similar to a type string or a type boolean. Eg, export class Event { checkin_datetime: Moment; } However, I'm getting a TypeScript…
Ka Mok
  • 1,937
  • 3
  • 22
  • 47
0
votes
1 answer

Angular2 addArticle is not a function

When clicked on the submit button, I encounter this msg in the console and also if someone can help me how to import the moment from node_modules to angula2 project!! My app.component.html

Manoj
  • 692
  • 1
  • 10
  • 24

0
votes
1 answer

Plunker add angular2-moment package into angular2 app

Using the default templates provided by Plunker to create angular2 apps, I've been trying to import angular2-moment into my angular2 app on Plunker. import * as moment from 'moment'; this is how my plunker config.js looks like System.config({ …
Ibraheem Al-Saady
  • 854
  • 3
  • 14
  • 30
0
votes
2 answers

Angular2-moment with Angular2-cli installation

I have installed angular2-moment into angular2-cli. While installing, angular2-cli does not have system.js, so where can I put these settings into? https://github.com/urish/angular2-moment/#for-systemjs-users Also I'm also getting following error:
Basit
  • 16,316
  • 31
  • 93
  • 154