Questions tagged [angular-moment]

AngularJS directive and filters for Moment.js. Angular moment provides the `am-time-ago` directive and a number of filters that include `amParse`, `amFromUnix`, `amUtc`, `amUtcOffset` and `amLocal`. Make sure to include momentjs and angularjs tags along with this tag.

Angular moment is a plugin that adds the following directives and filters to AngularJS based on the moment.js library.

  • Directives
    • am-time-ago - Use to format relative timestamps
  • Filters
    • amDateFormat - Format a date using moment.js format() method
    • amDurationFormat - Format a duration in a human readable format
    • amCalendar - Format a date using moment.js calendar() method
    • amTimezone - Apply a timezone to the given date or moment object
    • amLocal - Change the given moment object to be in the local timezone
    • amUtc - Create or switch the current moment object into UTC mode
    • amUtcOffset - Use the given UTC offset when displaying a date
    • amFromUnix - Convert a unix-timestamp into a moment object
    • amParse - Parse a custom-formatted date into a moment object
    • amAdd - Add hours, minutes or seconds from the specified date.
    • amSubtract - Subtract hours, minutes or seconds from the specified date.
    • amDifference - Get the difference between two dates in milliseconds
    • amStartOf - Mutate the original moment by setting it to the start of a minute, hour or day of time.
    • amEndOf - Mutate the original moment by setting it to the end of a minute, hour or day of time.

References

Related Tags

197 questions
0
votes
0 answers

"few seconds ago" and "a minute ago” text mismatches with the actual time given in angularjs

In my web application, we have a requirement to display the time as "few seconds ago" and "few minutes ago" based on the time pulled from the back-end. I am using the angular-moment and moment libraries. The text being displayed for the…
0
votes
1 answer

Angular-moment js shows older dates than what is actual

I am working on a ionic application to retrieve posts in raddit.com using their API. Now my problem is when I tried to show the time of post using angular-moment, it shows the post is posted 47 years ago, where actually the post is posted some…
user6536526
0
votes
1 answer

angular-moment not displaying time properly

I have below code for displaying date and time. {{event.date | amDateFormat:'DD.MM.YYYY HH:MM' }} Uhr {{event.modificationDate | amDateFormat:'DD.MM.YYYY HH:MM' }} Uhr and values for each is as below: $scope.event = { …
Pradeepb
  • 2,564
  • 3
  • 25
  • 46
0
votes
1 answer

Moment in typescript not recognized?

I ran these commands: npm install tsd -g tsd install moment --save it is also injecting into my module but when i am accessing it it is not recognizing moment. eg. import * as moment from 'moment'; Could you please help me out.
Lovepreet Singh
  • 73
  • 2
  • 10
0
votes
0 answers

Duration tracking in AngularJS

Im trying to handle durationc calculation in my AngularJS app. If User logged In then it should show timer counting time in Hr and Mins. for example. User logged in since 15 minutes passed then UI should show LoggedIn time: 0hr 15m. I tried to user…
Zaid Mirza
  • 3,540
  • 2
  • 24
  • 40
0
votes
2 answers

How to get UNIX time with moment.js with particular string format "last ..."?

In PHP, it's possible to say: $unixTimeOfLastSunday = strtotime("last Sunday"); Which would equate to something like this: 1465714800 How would one accomplish the same thing in either Javascript or AngularJS? EDIT - I am now using moment.js as an…
LatentDenis
  • 2,839
  • 12
  • 48
  • 99
0
votes
1 answer

Load angular-moment with moment - Error 'module' is not a function

I'm having some problems including angular-moment package using webpack. Let's say in my file app.js I include the file dependences in this way: import 'moment/src/moment'; import angularMoment from 'angular-moment'; angular.module('helloWorldapp',…
enricop89
  • 352
  • 2
  • 13
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
0
votes
1 answer

Angularjs ng-messages input[time]

i"m tring to display error with ng-message when first value input time inferior value input second any any idea please ? html controller $scope.mytime={}; $scope.mytime.morning=moment("06:00",…
ragnar
  • 1
  • 1
  • 3
0
votes
2 answers

Momentjs : convert 12 hour to Date object

I'm trying to convert 12 hour string to 24 Date object day.from = day.from || moment("6:00", ["h:mm"]).format("HH:mm"); but I'm getting this error: angular.js:11706 Error: [ngModel:datefmt] Expected `6:00` to be a date any idea please?
ragnar
  • 1
  • 1
  • 3
0
votes
2 answers

How to format a date in Moment.js

I'm having trouble formatting a date correctly in Moment.js. I'm using the format function with format "LLL D, YYYY" so it should return something like "Sep 15, 2016". Instead, it's returning a the date in a weird format like "September 15, 2016…
amacrobert
  • 2,707
  • 2
  • 28
  • 37
0
votes
1 answer

angular-moment not showing anything

I have in my controller a variable with the current date formatted as yyyy.MM.dd HH:mm:ss It is being formatted correctly since I'm printing it, and it look fine: 2016.09.01 16:13:15 in my view, I have a span like this:
Pablo
  • 9,424
  • 17
  • 55
  • 78
0
votes
1 answer

JavaScript: Moment diff function giving incorrect days difference

var firstDate=moment('Sat Jul 30 2016 00:00:00 GMT+0530 (India Standard Time)'); var secondDate=moment('Fri Jul 29 2016 10:56:39 GMT+0530 (India Standard Time)'); console.log(firstDate.diff(secondDate,'days')); Expected Output: 1 Actual Output:…
Prakash Gupta
  • 203
  • 1
  • 4
  • 13
0
votes
1 answer

Get days of the week based on week number

Is there a way to get the Sunday thru Saturday dates of the week based on week number? For example the current week number is 32, so I would want an array (or some return type) as such: ["Sunday, July 3rd, 2016", "Monday, July 4th, 2016".... etc …
NealR
  • 10,189
  • 61
  • 159
  • 299
0
votes
0 answers

Angular moment picker in fancybox

When I click on datapicker (angular moment picker) after load it in inline fancybox, it output empty window. But if I click on datapicker input directly - all works fine. I use fancybox as directive: .directive('fancybox', function ($compile,…
MikeDiam
  • 111
  • 1
  • 11