Formatting numeric values in JavaScript
Learn common number formatting operations, such as rounding, padding, optional decimal marks, currency, seconds, bytes, and more.
The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Learn common number formatting operations, such as rounding, padding, optional decimal marks, currency, seconds, bytes, and more.
Learn how to calculate date difference in seconds, minutes, hours, days etc. in vanilla JavaScript.
Leverage the Date
object to check if a given date is inside business hours.
Learn how you can implement a delay function using setTimeout()
, promises and async
/await
.
Learn how to manipulate Date
objects to add minutes, hours, days and more.
Determine the day, week, month, or quarter of the year that a date corresponds to, using vanilla JavaScript.
Quickly find the minimum or maximum date in an array of dates.
Creates a generator, that generates all dates in the given range using the given step.
Checks if a valid date object can be created from the given values.
Learn how you can compare two dates in JavaScript, determining which one comes before or after the other.
Convert a date to extended ISO format (ISO 8601), including timezone offset.
Easily calculate the date of yesterday, today or tomorrow in JavaScript.
Calculate the number of days in a month for a given year using JavaScript.
Returns a string of the form HH:MM:SS
from a Date
object.
Quickly and easily determine if a given JavaScript Date
object is a weekday or weekend.
Gets the name of the weekday from a Date
object.
Calculate the date of n
days ago from today or the date of n
days from now.
Easily convert between a JavaScript Date object and a Unix timestamp.
Use the Date
object and some clever tricks to get the first or last date of a month in JavaScript.
Checks if the given year
is a leap year.