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
1 answer

Wrong time difference with momentjs diff function

i'm trying to calculate the difference between two UTC Datetime Strings with angular-momentjs like shown below: var start = "1970-01-01T11:03:00.000Z"; var end = "1970-01-01T11:15:00.000Z"; var duration =…
julian
  • 51
  • 1
  • 7
0
votes
1 answer

angular-moment is not loaded by angular in meteor app

I do tutorial from angular-meteor.com. angular-moment worked well. Then I added some Ionic elements to html page and empty stub method to controller. And got the message: 13:07:29.038 Error: [$injector:modulerr] Failed to instantiate module …
Dmitry
  • 727
  • 1
  • 8
  • 34
0
votes
1 answer

Angularjs $viewValue without changing $modelValue

In Angular (1.4.x), is the there a way to dynamically change the input context without changing the $modelValue? So for example: is it possible to dynamically toggle a time (moment) input text/content for local/utc without changing the $modelValue.…
0
votes
2 answers

how do i add angular-moment filter here?

Am new to angularjs and given a codebase to add angular-moment (moments.js) to a module. The module is defined is as follows: angular.module("xyz", ["ngRoute", "ui.bootstrap", …
BoCode
  • 847
  • 4
  • 17
  • 33
0
votes
2 answers

Display datetime from json without formatting to locale timezone in javascript with moment.js

Get following date from JSON response: 1470995100000 But angular-moment will convert this long to the current date + timezone offset. How can i avoid this? {{ item.startDate | amDateFormat:'HH:mm' }} Should be = 07:55 (correct value from database -…
Benni
  • 91
  • 1
  • 1
  • 7
0
votes
0 answers

amTimeAgo in angular-moment make crazy calcs

So I'm trying to use directive amTimeAgo of momment JS in Angular, like this: I'm usting angular-moment (https://github.com/urish/angular-moment)…
Wagner Moreira
  • 1,033
  • 1
  • 16
  • 40
0
votes
0 answers

Add time with angular-moment into span

Using angular-moment and simply trying to add a date based on one supplied. Angular-moment is loading, but nothing happening. Here is my snipet:

Last day to submit order for…

Mark
  • 1,812
  • 3
  • 29
  • 51
0
votes
1 answer

How to perform internationalization of custom date using angularjs in HTML

Suppose there is a date say and in HTML I have written
{{theDate | date :…
Kamaldeep Singh
  • 765
  • 2
  • 8
  • 28
0
votes
1 answer

Angular-moment with ISO string

I'm using amCalendar filter from angular-moment to show the moment in the view. p.example: "Today 2:30 AM". The amCalendar filter not accept Date as a type. I created this function that returns the short date ISO string passing a Date…
Aral Roca
  • 5,442
  • 8
  • 47
  • 78
0
votes
2 answers

angular-moment TypeError: momentValue.toISOString is not a function

getting the following error using the angular-moment meteor package angular.js:12332 TypeError: momentValue.toISOString is not a function at updateMoment (angular-moment.js:199) at Object.fn (angular-moment.js:215) at…
0
votes
1 answer

Inject angularMoment library to Meanjs angular app

Trying to use angular-moment library. (Not sure if I can add a link to it here). Tried to use it as shown in github repo. Added libraries to the index file, moment, angularMoment and then... angular.module('chat',…
DasBoot
  • 469
  • 6
  • 17
0
votes
2 answers

"moment is undefined" when launching angular app in node-webkit

I want to launch my angular application which works in general, but when I get to use moment I got the error that "moment" is undefined. I am using "angular-moment" from here var app = angular.module("MyApp", [ "ngRoute", "ui.bootstrap", …
Tenoda
  • 193
  • 2
  • 14
0
votes
2 answers

Handling UTC dates client side

Here is the situation: I have occurred_at dates stored in my database in UTC. I'm using laravel to write an API method that returns records that contain these occurred_at fields. They are currently being returned via JSON in a string format (what…
Steven M
  • 574
  • 3
  • 18
0
votes
2 answers

Can't change timezone with angular-moment

I am using Angular.js with angular-moment and I am trying to display a date in a different timezone: p(style="font-size: 70%",am-time-ago="thing.date") I am including moment.js, as well as the moment.js timezone data (this file). In my .html file: …
cgf
  • 3,369
  • 7
  • 45
  • 65
0
votes
1 answer

Customize calendar function in angularMoment

I would like to use customized output for calendar in angularMoment. In momentjs I set it up with: moment.lang('en', { calendar : { lastDay : '[Yesterday at] LT', sameDay : '[Today at] LT', nextDay : '[Tomorrow at] LT', lastWeek :…
Mark Kasson
  • 1,600
  • 1
  • 15
  • 28