2017-08-28 46 views

回答

0

嗨,你可以看看这个帖子

set locale in datepipe

我认为上述职位工作正常,你可以检查

+0

IM已经使用代码从后 – None

+0

好让我查 – Robert

+0

嗨,我们可以这样做https://stackoverflow.com/a/40090356/7261317 – Robert

0
你的模块模块

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { LOCALE_ID } from '@angular/core'; 

import { AppComponent } from './app.component'; 

@NgModule({ 
imports:  [ BrowserModule ], 
declarations: [ AppComponent ], 
bootstrap: [ AppComponent ], 
providers: [ 
    { provide: LOCALE_ID, useValue: 'bs-BA' }, 
], 
}) 

export class AppModule { } 

在组件

import { Component } from '@angular/core'; 

@Component({ 
selector: 'my-app', 
    template: ` 
    {{date | date: 'd MMMM y'}} 
` 
}) 
export class AppComponent { 

    date = new Date(1988, 2, 15); 
} 

This for "bs-BA"

This for "en-US"

+0

的http:// plnkr .co/edit/MCBOzRtrA5FtBfOfVWQc?p = preview – None

+0

我没有得到月份名称 – None

+0

MO3不是月份名称...它在波斯尼亚语上没有任何内容 – None