Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用角度默认日期管道来格式化我的日期,使用此代码。
{{'27-04-2021 08:30:00' | utcDate | date: 'EE, d MMMM OOOO'}}
结果是Tue, 27 April GMT+05:30
Tue, 27 April GMT+05:30
我必须将结果显示为Tue, 27 April GMT+5:30
Tue, 27 April GMT+5:30
我必须将 GMT 格式从XX:XX to X:XX.
XX:XX to X:XX
谢谢。
在您的组件中定义此方法。
replaceZone = (val: string | null): string => { if (val == null) { return ''; } return val.replace(/0(\d:\d{2})$/, '$1'); }
然后像这样调用。
{{replaceZone('27-04-2021 08:30:00' | utcDate | date: 'EE, d MMMM OOOO')}}