角度2日期管道周数

角度2日期管道周数

本文介绍了角度2日期管道周数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了如何在Angular 2中返回星期数.我没有找到这个问题的答案.我确实在 https://docs.angularjs.org/api/ng/filter/date找到了在Angular 1中将是这样的:{{today | date:'w'}},但在Angular 2中似乎不起作用.我知道我可以编写一个函数来处理此问题,但这似乎不切实际.我是否在有关Angular 2的文档中丢失了某些内容?还是尚未实现?

I looked up how to return the week number in Angular 2. I have not found an answer to this question.I did find on https://docs.angularjs.org/api/ng/filter/date that in Angular 1 it would be something like this: {{today | date:'w'}} but this does not seem to work in Angular 2. I know I can write a function to take care of this but this doesn't seem practical. Am I missing something in the documentation about Angular 2 or is this not (yet) implemented there?

推荐答案

DatePipe 当前不支持weekOfYear.

不过,您可以实现自己的WeekOfYear管道.
请参阅 https://angular.io/docs/ts/latest/guide/pipes. html 以获得更多详细信息.

You can implement your own WeekOfYear pipe though.
See https://angular.io/docs/ts/latest/guide/pipes.html for more details.

这篇关于角度2日期管道周数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 11:10