Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-29 20:36:07 +02:00
parent a2f959334b
commit c56b5a11da
16 changed files with 23 additions and 22 deletions

View File

@ -8,7 +8,7 @@ lastUpdated: 2021-10-13T19:29:39+02:00
Converts a date to extended ISO format (ISO 8601), including timezone offset.
- Use `Date.prototype.getTimezoneOffset()` to get the timezone offset and reverse it. Store its sign in `diff`.
- Define a helper function, `pad`, that normalizes any passed number to an integer using `Math.floor()` and `Math.abs()` and pads it to `2` digits, using `String.prototype.padStart()`.
- Define a helper function, `pad()`, that normalizes any passed number to an integer using `Math.floor()` and `Math.abs()` and pads it to `2` digits, using `String.prototype.padStart()`.
- Use `pad()` and the built-in methods in the `Date` prototype to build the ISO 8601 string with timezone offset.
```js