From e9019d4c20474a2f3a37fc931ec131e4cdd21f7f Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Sun, 30 Jan 2022 12:01:08 +0200 Subject: [PATCH] Update formatting --- snippets/addDaysToDate.md | 2 +- snippets/addMinutesToDate.md | 2 +- snippets/dayOfYear.md | 2 +- snippets/daysInMonth.md | 4 ++-- snippets/fromTimestamp.md | 2 +- snippets/isISOString.md | 2 +- snippets/isLeapYear.md | 2 +- snippets/lastDateOfMonth.md | 2 +- snippets/maxDate.md | 2 +- snippets/minDate.md | 2 +- snippets/tomorrow.md | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/snippets/addDaysToDate.md b/snippets/addDaysToDate.md index 7b097bfee..b318679dc 100644 --- a/snippets/addDaysToDate.md +++ b/snippets/addDaysToDate.md @@ -7,7 +7,7 @@ lastUpdated: 2020-11-28T19:18:29+02:00 Calculates the date of `n` days from the given date, returning its string representation. -- Use `new Date()` to create a date object from the first argument. +- Use the `Date` constructor to create a `Date` object from the first argument. - Use `Date.prototype.getDate()` and `Date.prototype.setDate()` to add `n` days to the given date. - Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format. diff --git a/snippets/addMinutesToDate.md b/snippets/addMinutesToDate.md index 790fa2072..e0f1a11b2 100644 --- a/snippets/addMinutesToDate.md +++ b/snippets/addMinutesToDate.md @@ -7,7 +7,7 @@ lastUpdated: 2020-11-28T19:27:46+02:00 Calculates the date of `n` minutes from the given date, returning its string representation. -- Use `new Date()` to create a date object from the first argument. +- Use the `Date` constructor to create a `Date` object from the first argument. - Use `Date.prototype.getTime()` and `Date.prototype.setTime()` to add `n` minutes to the given date. - Use `Date.prototype.toISOString()`, `String.prototype.split()` and `String.prototype.replace()` to return a string in `yyyy-mm-dd HH:MM:SS` format. diff --git a/snippets/dayOfYear.md b/snippets/dayOfYear.md index b38c819a5..417544e79 100644 --- a/snippets/dayOfYear.md +++ b/snippets/dayOfYear.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-19T18:51:03+03:00 Gets the day of the year (number in the range 1-366) from a `Date` object. -- Use `new Date()` and `Date.prototype.getFullYear()` to get the first day of the year as a `Date` object. +- Use the `Date` constructor and `Date.prototype.getFullYear()` to get the first day of the year as a `Date` object. - Subtract the first day of the year from `date` and divide with the milliseconds in each day to get the result. - Use `Math.floor()` to appropriately round the resulting day count to an integer. diff --git a/snippets/daysInMonth.md b/snippets/daysInMonth.md index d4728bcfc..fa0bf47aa 100644 --- a/snippets/daysInMonth.md +++ b/snippets/daysInMonth.md @@ -6,9 +6,9 @@ firstSeen: 2021-06-13T05:00:00-04:00 Gets the number of days in the given `month` of the specified `year`. -- Use the `new Date()` constructor to create a date from the given `year` and `month`. +- Use the `Date` constructor to create a date from the given `year` and `month`. - Set the days parameter to `0` to get the last day of the previous month, as months are zero-indexed. -- Use `Date.prototype.getDate()` to return the number of days in the given `month`. +- Use `Date.prototype.getDate()` to return the number of days in the given `month`. ```js const daysInMonth = (year, month) => new Date(year, month, 0).getDate(); diff --git a/snippets/fromTimestamp.md b/snippets/fromTimestamp.md index 7a2b5db98..31abaeaa2 100644 --- a/snippets/fromTimestamp.md +++ b/snippets/fromTimestamp.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-15T21:57:17+03:00 Creates a `Date` object from a Unix timestamp. - Convert the timestamp to milliseconds by multiplying with `1000`. -- Use `new Date()` to create a new `Date` object. +- Use the `Date` constructor to create a new `Date` object. ```js const fromTimestamp = timestamp => new Date(timestamp * 1000); diff --git a/snippets/isISOString.md b/snippets/isISOString.md index dc76195a0..8383c5b1c 100644 --- a/snippets/isISOString.md +++ b/snippets/isISOString.md @@ -7,7 +7,7 @@ lastUpdated: 2020-11-29T12:16:43+02:00 Checks if the given string is valid in the simplified extended ISO format (ISO 8601). -- Use `new Date()` to create a date object from the given string. +- Use the `Date` constructor to create a `Date` object from the given string. - Use `Date.prototype.valueOf()` and `Number.isNaN()` to check if the produced date object is valid. - Use `Date.prototype.toISOString()` to compare the ISO formatted string representation of the date with the original string. diff --git a/snippets/isLeapYear.md b/snippets/isLeapYear.md index 8760ec1f4..099b31244 100644 --- a/snippets/isLeapYear.md +++ b/snippets/isLeapYear.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-20T23:02:01+03:00 Checks if the given `year` is a leap year. -- Use `new Date()`, setting the date to February 29th of the given `year`. +- Use the `Date` constructor, setting the date to February 29th of the given `year`. - Use `Date.prototype.getMonth()` to check if the month is equal to `1`. ```js diff --git a/snippets/lastDateOfMonth.md b/snippets/lastDateOfMonth.md index b9081082a..41875fc8d 100644 --- a/snippets/lastDateOfMonth.md +++ b/snippets/lastDateOfMonth.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-09T22:01:42+03:00 Returns the string representation of the last date in the given date's month. - Use `Date.prototype.getFullYear()`, `Date.prototype.getMonth()` to get the current year and month from the given date. -- Use the `new Date()` constructor to create a new date with the given year and month incremented by `1`, and the day set to `0` (last day of previous month). +- Use the `Date` constructor to create a new date with the given year and month incremented by `1`, and the day set to `0` (last day of previous month). - Omit the argument, `date`, to use the current date by default. ```js diff --git a/snippets/maxDate.md b/snippets/maxDate.md index a0a73ebfd..ff659194c 100644 --- a/snippets/maxDate.md +++ b/snippets/maxDate.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-21T21:54:53+03:00 Returns the maximum of the given dates. - Use the ES6 spread syntax with `Math.max()` to find the maximum date value. -- Use `new Date()` to convert it to a `Date` object. +- Use the `Date` constructor to convert it to a `Date` object. ```js const maxDate = (...dates) => new Date(Math.max(...dates)); diff --git a/snippets/minDate.md b/snippets/minDate.md index cef2041e2..e30852bc2 100644 --- a/snippets/minDate.md +++ b/snippets/minDate.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-21T21:54:53+03:00 Returns the minimum of the given dates. - Use the ES6 spread syntax with `Math.min()` to find the minimum date value. -- Use `new Date()` to convert it to a `Date` object. +- Use the `Date` constructor to convert it to a `Date` object. ```js const minDate = (...dates) => new Date(Math.min(...dates)); diff --git a/snippets/tomorrow.md b/snippets/tomorrow.md index 8ceed206e..f0aa229bc 100644 --- a/snippets/tomorrow.md +++ b/snippets/tomorrow.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:30+03:00 Results in a string representation of tomorrow's date. -- Use `new Date()` to get the current date. +- Use the `Date` constructor to get the current date. - Increment it by one using `Date.prototype.getDate()` and set the value to the result using `Date.prototype.setDate()`. - Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format.