Skip to content

Commit e42e3b1

Browse files
committed
feat: Configure Spanish locale for date formatting in configuracion component
1 parent fd08c3b commit e42e3b1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/app/pages/configuracion/configuracion.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Component} from '@angular/core';
1+
import {Component, LOCALE_ID} from '@angular/core';
22
import {FormsModule} from '@angular/forms';
33
import {PDFDocument, rgb, StandardFonts} from 'pdf-lib';
44
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
55
import moment from 'moment';
6+
import 'moment/locale/es';
67
import {DatePipe, registerLocaleData} from '@angular/common';
78
import localeEs from '@angular/common/locales/es';
89

@@ -49,6 +50,9 @@ export interface FechaEspecial {
4950
FormsModule,
5051
DatePipe
5152
],
53+
providers: [
54+
{ provide: LOCALE_ID, useValue: 'es' }
55+
],
5256
templateUrl: './configuracion.html',
5357
styleUrl: './configuracion.scss'
5458
})
@@ -74,8 +78,9 @@ export class Configuracion {
7478
}
7579

7680
formatearFechaEspanol(fecha: string): string {
77-
// Asegura que moment use el locale español para el mes
78-
return moment(fecha).locale('es').format('DD [de] MMMM [de] YYYY');
81+
// Configurar moment a español y formatear
82+
moment.locale('es');
83+
return moment(fecha).format('DD [de] MMMM [de] YYYY');
7984
}
8085

8186
contarDiasEspeciales(): number {

0 commit comments

Comments
 (0)