Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
361 views
in Technique[技术] by (71.8m points)

angular - With the MomentModule, how do I format times greater than an hour to include minutes with the "amTimeAgo" pipe?

I'm using the MomentModule ( https://github.com/urish/ngx-moment ) with my Angular 9 application. In my compoment, I have a function that returns a Date

  getCreatedOn(stat: Stat): Date {
    ...
  }

and then I use the pipe like so

{{ getCreatedOn(stat) | amTimeAgo }}

For values that are less than an hour from now, I see results like

37 minutes ago

which is just fine. For values greater than 1 hour, the result printed is

1 hour ago

What I would like is for it to print the minutes as well

1:32 ago

How would I configure the pipe to display minutes? If the result is greater than 1 day, it is fine if the module continues to print

1 day ago
question from:https://stackoverflow.com/questions/65890998/with-the-momentmodule-how-do-i-format-times-greater-than-an-hour-to-include-min

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...