D
D
David King2020-08-30 22:54:01
JavaScript
David King, 2020-08-30 22:54:01

How to return month name from month number?

Welcome to the HABR Internet portal! And... But fuck these conventions, SHORTER: when I try to convert the month number into a name, I don't get the month! What to rob?

Here is the code:

let date = "2020-08-30 21:00:00";
let month = Number(date.slice(5,7));

day_temp.textContent = Math.floor(data['list'][0]['main']['temp']) - 273 + "°";
day_date.textContent = month.toLocaleString('default', {month: 'long'});


Do not swear for the fact that I take a month in a moronic way. It's just that the API returns such a string.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2020-08-30
@javaScriptIsPooP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question