Search Posts

Category: momentjs

How can I convert a date and time into a time only using angular-moment?

So I have dates like this: $scope.sample_time = “September 14th 2017, 1:00:00 pm”; And in my view, I want to only show the time like example 1:00 pm. Using angular-moment, I tried something like {{ sample_time | amParse:’HH:mm a’}} but I get 2017-09-14T06:00:00.000Z. Am I missing something here? Any help would be much appreciated. Source: AngularJS

Getting Moment JS to display time ago up to yesterday then start displaying a formatted date

Disclaimer: I’m very new to javascript (and angular). I’m trying to get momentjs to display the time from now up till yesterday. Once it’s been 3 days it would display the actual date. Example using random date (date diff will always be “today”): 10/10/17 at 6:41 pm (future) Tomorrow at 6:41 pm Today at 6:41 pm Yesterday at 6:41 pm 10/10/17 at 6:41 pm Not sure what other information I should provide but please ask […]