# iso-date-formatter

> Simple mini ISO date formatter

Latest version **2.0.2** (published 2020-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install iso-date-formatter
pnpm add iso-date-formatter
yarn add iso-date-formatter
bun add iso-date-formatter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-04-11 |
| First published | 2019-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | https://github.com/boombang |
| Maintainers | boombang |

## Links

- npm: https://www.npmjs.com/package/iso-date-formatter
- Repository: https://github.com/boombang/iso-date-formatter
- Homepage: https://github.com/boombang/iso-date-formatter#readme
- Issues: https://github.com/boombang/iso-date-formatter/issues
- npm.io page: https://npm.io/package/iso-date-formatter

## Recent versions

- 2.0.2 (latest) — 2020-04-11
- 2.0.1 — 2019-07-31
- 2.0.0 — 2019-07-01
- 1.0.0 — 2019-06-23

## README

# ISO Date Formatter
[![npm module](https://badge.fury.io/js/iso-date-formatter.svg)](https://www.npmjs.org/package/iso-date-formatter)
[![dependencies](https://david-dm.org/boombang/iso-date-formatter.svg)](https://david-dm.org/boombang/iso-date-formatter)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)](license.txt)

Installation
------------
```bash
npm install iso-date-formatter --save
```

Usage
-----
```js
import ISODateFormatter from 'iso-date-formatter';

const isoDate = '2019-06-04T14:03:07.007Z';
const formattedDate = ISODateFormatter(isoDate, { format: 'dd MM yyyy HH:mm' }); // => 04 06 2019 14:03
```

Options
-------
The second parameter is the options object:

| Option        | Type    | Default                       | Description
| -----------   | ------- | ----------------------------- | --------------
| `format`      | String  | `dd MM yyyy HH:mm:ss`         | A string which consists of any symbols and tokens. Tokens will be changed by corresponding value from the input string in ISO format.
| `namedMonths` | Array   | result of `MM`                | An array of named months e.g `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']` which is used if token `MMM` is provided in `format` option

Tokens
------
Examples below given for 2019-06-04T14:03:07.007Z

| Name   | Description                       | Example |
|--------|-----------------------------------|---------|
| `yyyy` | four-digit year                   | 2019    |
| `yy`   | two-digit year                    | 19      |
| `MMM`  | month from `namedMonths` option   | Jun     |
| `MM`   | month as an padded number         | 06      |
| `M`    | month as an unpadded number       | 6       |
| `dd`   | day of the month, padded to 2     | 04      |
| `d`    | day of the month, no padding      | 4       |
| `HH`   | hour in 24-hour time, padded to 2 | 14      |
| `H`    | hour in 24-hour time, no padding  | 14      |
| `hh`   | hour in 12-hour time, padded to 2 | 02      |
| `h`    | hour in 12-hour time, no padding  | 2       |
| `mm`   | minute, padded to 2               | 03      |
| `m`    | minute, no padding                | 3       |
| `ss`   | second, padded to 2 padding       | 07      |
| `s`    | second, no padding                | 7       |
| `SSS`  | millisecond, padded to 3          | 007     |

---
_Source: https://npm.io/package/iso-date-formatter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
