All right, so we've got some kind of date, but the goal is to have more friendlier format when we
display that.
And if you have taken my vanilla jobs, of course, or if you have been working on my Vanilla Joska
project, you know that there is a way how you can do that in villages.
So let me just quickly assure you, we have vanilla JavaScript projects.
So these are all the projects we're doing.
And my vision, not just course, but more specifically, we have this countdown timer.
And you'll notice that we have the format, we have the day, we have the date and the month and the
year, of course.
And yes, in this project, we did everything using vanilla.
Yes.
But if you worked on a project, you know that it wasn't a walk in the park.
It wasn't just a few lines of code.
There was some intense coding involved.
And of course, when I say intense, it doesn't mean that it was particularly hard, but it just took
us at least 20 lines of code to get this kind of person.
And instead, in this project, instead of going the religious route, I'm going to show you a moment
just which is, like I already previously mentioned, one of the most popular libraries to work with
JavaScript page.
And you simply go to moment a Jayesh and then in here follow the link.
So and in order to install the package, you just need to go with NPM install moment.
And then, of course, on this project, if you check out the package based on where you have it.
So we have the moment.
Yes, I'm just telling you, if you need to install it for your own project and then once you install
it, we need to run moment and then how we would want to format it.
Now, I'm not going to cover each and every option they provide.
You know where to find the documentation.
Of course, you can experiment with your own values.
In my case, essentially, we're just going to go with day nine of the date as well as the year.
And the idea is following where we go with some kind of letter on this, because if we want to have
a month, which is go with four arms, and of course, we will tinker around with these values a little
bit just so I can see different results.
So we would need to navigate back to our project.
And we're looking for article I already imported at the moment, from the moment that's the library.
And then you can either do it above the return if you want to test out the values or you can simply
do it directly in the process where I'm going to go back to the Joske plant.
That's why I have the Curley's.
Then we go with the moment and we would need to pass in that date.
So, of course, every article gets its unique date.
So we just pass in the date and then once we get the date, then we would want to run for a month and
then how we would want to format that date.
So I'm going to go here with date.
And then right after that, we're going to go with format and then, like I said, I'm going to go with
day, the date and then year, but we will tinker with these values a little just so I can see different
results.
And in order to get my format, I just need to go with Forty's then D and then all the nonsense.
I would want to have a comma.
I just add a comma, just like in regular text and in order to display the year which is go with four
uppercase, why now?
If you want to see how it's going to look like with different values, we'll just change it around.
What if we go here with one simple B?
Then of course we just get four, meaning the date is four.
If you're going to go with two days and of course you're getting a shorter name so you don't have some.
They just have short name.
If you go with three, as you can see now, you're getting three letters and hopefully you get the gist.
So if, for example, I would want to add the month, I just go here and I'm going to say four MS.
And now I have October and then Sunday fourth and then twenty twenty.
And if I'm going to go to uppercase and then of course I'm just getting the number for my month.
And since October is a ten month, that's why you have value often now if you don't pass anything.
So if I remove everything then of course I'm just going to have this long value.
So I'm going to go back to my original one.
So DDD and the on line, of course I would want to display the year as well.
And like I said, if you're interested in different formats, not navigate the documentation and get
the value that you need.
But the basic setup would be following where you would need to install the moment a library and you
just one moment, which of course is already important from the moment, just library and then you pass
in the date, which of course, in our case is available in our article.
Then we invoke format and we just need to specifically say, well, what is the format that we're looking
for?
And with one line of code, essentially, you get the format that you are looking for.