【问题标题】:use Angular dateformat but not in pipe [duplicate]使用 Angular 日期格式,但不在管道中 [重复]
【发布时间】:2019-02-13 14:28:57
【问题描述】:

我想使用 Angular 的 datePipe 使用的函数 formatDate 函数在:

angular/packages/common/src/i18n/format_date.ts

当我尝试导入它时:

import {format_date} from '@angular/common/src/i18n/format_date' 我收到一个错误:

找不到模块“@angular/common/src/i18n/format_date”

在业务逻辑文件(不是管道)中使用此函数(或管道上使用的任何其他函数)的任何解决方案

【问题讨论】:

  • 虽然问题略有不同,但我认为它仍然可以回答。如果您没有摔倒,请通知我,以便我重新打开它。

标签: angular date angular-i18n


【解决方案1】:

应该是formatDate

import { formatDate } from '@angular/common';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-24
    • 2020-12-26
    • 2023-03-15
    • 1970-01-01
    • 2021-08-30
    相关资源
    最近更新 更多