0
I bought a new bootstrap template for my system, and it came with an included business that returns several alerts, Moment.js.
From what I understand it is like a client-side validation library with language support and conversion of some date formats and I didn’t understand anything else besides that.
Example:
I have a daterange to generate reports, and when active this daterange, Moment notifies my console:
Deprecation Warning: Moment(). subtract(period, number) is deprecated. Please use Moment(). subtract(number, period).
But the code works, and if I correct that informed Warning, the daterange stops working as it should.
The question is:
What is Moment.js really for. ?
What I can do with it ?
Note: I ask this because I didn’t really see any use in it, and several templates come with it coupled, but I believe I’m wrong about that and that provavelment it should be useful.
Moment.js is the largest (and perhaps the best) library to work with Javascript dates. If the code stops working when you correct the code for the syntax/API that the warning indicates I suggest you put an example here in the question to help us.
– Sergio
@Sergio my doubt is not for the code or some error, I treat dates with PHP on my system, I want to understand what it is and what to do with it, and who knows how to use it, because I could not understand alone how it works.
– AnthraxisBR
The API for working with javascript date/time is kind of limited, the idea of Moment.js is to fill these gaps and make certain tasks simpler. See a example
– rray
@Can you give me a link with an article about him ? the ones I read didn’t clarify much, it’s just tutorial on how to do things or it’s a very simple summary, can be in English without problems
– AnthraxisBR