A
A
Anatoly Kuchin2020-07-16 17:34:27
JavaScript
Anatoly Kuchin, 2020-07-16 17:34:27

How to make it so that when the date 05/27/2020 18:19:47 is displayed, it writes “Last month” or “In May”?

There is a date in the format "05/27/2020 18:19:47".
How to make it so that when the date 05/27/2020 18:19:47 is displayed, it writes "Last month" or "In May".

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2020-07-16
@devil40rus

https://momentjs.com/

R
Roman Andreevich, 2020-07-16
@RomanDillerNsk

You need to make a function that takes a month from your date, compare it with the current month and make a condition, if the difference === 1 then return "last month", if more, then "in ${ month }"
Well, month, respectively, incline need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question