Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
get the day of the date in text format

Returning a list from the backend. This list is the notifications list. I want to write the date of each element next to it. But I want to write only the day of this date as text. I want these days in abbreviated TR format.

For example;

Sal (TR) = Tue

enter image description here

const stringToDate = (stringDate) => { // stringDate: '16-05-2022'
  const dateArray = stringDate.split('-');
  return (new Date(dateArray[2], (dateArray[1] - 1).toString().padStart(2, '0'), dateArray[0].padStart(2, '0')));
};

const day = new Date(stringToDate(props.notification?.notificationList?.createdAt));
const notificationDay = day.toLocaleString('tr', { day: 'short' });
console.log(notificationDay);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use weekday

const notificationDay = day.toLocaleString('tr', { weekday: 'short' });
console.log(notificationDay);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda