Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-30 12:01:08 +02:00
parent 48790982c1
commit e9019d4c20
11 changed files with 12 additions and 12 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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();

View File

@ -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);

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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));

View File

@ -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.