Moment.js using with Typescript
In this article, we will learn how to use the Moment.js library with Typescript language. Typescript is a strongly-typed programming language that wraps JavaScript and gives it optional static typing. It is free and open source and is maintained by Microsoft....
read more
Moment.js moment().endOf() Method
The moment().endOf() method is used to mutate the Moment so that it is set to the end of the given unit of time. The available units of time can be the year, month, quarter, week, day, hour, minute and second....
read more
Moment.js moment.second() Method
The moment().second() Method is used to get the seconds from the current time or to set the seconds....
read more
Moment.js Parsing String
Moment.js is a date library for JavaScript that parses, validates, manipulates, and formats dates. We can use the moment() function passed with a string to parse dates represented as strings....
read more
Moment.js moment.duration().add() Method
The moment().duration().add() method is used to add a given time to the duration. The time to be added can be another Duration object, value in milliseconds, or a representation of the time using a string and numerical value. All the shorthands and keys used for creating durations can be used here for the time....
read more
Moment.js moment().calendar() Function
The moment().calendar() function is used to displays calendar time which is relative to a given referenceDay. By default, it is set to the start of the current day i.e. today....
read more
Moment.js Introduction
Moment.js is a powerful JavaScript library used for parsing, validating, manipulating, and formatting dates and times. It simplifies date and time operations, offering an extensive range of features and support for various formats. In this guide, we’ll introduce Moment.js, highlighting its key functionalities and showing how it can streamline date and time handling in your JavaScript applications. Whether you’re dealing with complex date calculations or formatting requirements, Moment.js is an essential tool for developers....
read more
Moment.js moment().isoWeek() Method
The moment().isoWeek() method is used to get or set the ISO week of the Moment object. An ISO week-numbering system considers leap weeks in its system. This allows it to have only 52 or 53 full weeks. This is made possible by considering the number of days to be either 364 or 371 days instead of 365 or 366 days. This makes the method return the same date regardless of its locale....
read more
Moment.js moment.duration().minutes() Method
The moment().duration().minutes() method is used to get the number of minutes of the duration. This number of minutes is calculated as a subset of an hour, therefore having a value between 0 and 59....
read more
Moment.js moment().max() Method
The moment().max() method is used to return the maximum (or the most distant future) Moment of the given array of Moment objects. It will return the Moment instance of the current time if no argument is passed....
read more
Moment.js moment.duration().subtract() Method
The moment().duration().subtract() method is used to subtract the given time from a duration. The time to subtract can be another Duration object, value in milliseconds, or a representation of the time using a string and numerical value. All the shorthands and keys used for creating durations can be used here for the time....
read more
Moment.js moment.duration().humanize() Method
The moment().duration().humanize() Method is used to return the length of the duration in a human-readable format. The text returned is suffix-less by default, however, suffixes can also be added by specifying the withSuffix parameter. This can also be used for denoting past time by using negative durations....
read more