Answer the question
In order to leave comments, you need to log in
How to get the day of the week localized for a specific country?
Colleagues, good day, tell me who came across how to get the actual localized day of the week ???
static getDateObject() {
let object = {};
let days = {
0: 'sunday',
1: 'monday',
2: 'tuesday',
3: 'wednesday',
4: 'thursday',
5: 'friday',
6: 'saturday'
};
let locales = `en-AR`;
let options = {
timeZone: "America/Argentina/Buenos_Aires",
hour12: false
};
let date = new Date();
object.full = date.toLocaleString(locales, options);
object.day = days[date.getDay().toLocaleString(locales, options)];
object.hour = this.getLocalHour(object.full);
return object;
}
Answer the question
In order to leave comments, you need to log in
see Date.toLocaleString()
(new Date()).toLocaleString('es-AR', {
weekday: 'long'
})
// "domingo"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question