You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
663 B

5 years ago
## Unicode Technical Report 35
### Subject
Create a function named `format` which accepts a valid `Date` and a format `string`. Your function should return a correctly formatted string.
Your function must handle:
- `y`
- `yyyy`
- `G`
- `GGGG`
- `M`
- `MM`
- `MMM`
- `MMMM`
- `d`
- `dd`
- `E`
- `EEEE`
- `h`
- `hh`
- `m`
- `mm`
- `s`
- `ss`
- `H`
- `HH`
- `a`
### Example
```js
const d = new Date('7 January 1985, 3:08:19')
format(d, 'HH(mm)ss [dd] <MMM>') // -> '03(08)19 [07] <Jan>'
```
5 years ago
### Notions
- [Unicode Date Field Symbol Table](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table)