# format-date-time

> Small date and time formater. Format by user mask or with default format

Latest version **0.3.3** (published 2020-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install format-date-time
pnpm add format-date-time
yarn add format-date-time
bun add format-date-time
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2020-11-01 |
| First published | 2017-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.2.4 |
| Dependencies | 0 |
| Unpacked size | 19.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | “Andrey |
| Maintainers | andreydos |
| Keywords | date, datetime, timeformat, dateformat |

## Links

- npm: https://www.npmjs.com/package/format-date-time
- Repository: https://github.com/andreydos/date-time-format
- Homepage: https://github.com/andreydos/date-time-format#readme
- Issues: https://github.com/andreydos/date-time-format/issues
- npm.io page: https://npm.io/package/format-date-time

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.3.3 (latest) — 2020-11-01
- 0.3.2 — 2019-05-13
- 0.3.1 — 2019-05-13
- 0.3.0 — 2017-10-09
- 0.2.1 — 2017-10-02
- 0.2.0 — 2017-10-02

## README

# format-date-time

[![Build Status](https://travis-ci.org/andreydos/date-time-format.svg?branch=master)](https://travis-ci.org/andreydos/date-time-format)
[![Coverage Status](https://coveralls.io/repos/github/andreydos/date-time-format/badge.svg?branch=master)](https://coveralls.io/github/andreydos/date-time-format?branch=master)

# Date time formatter

Lightweight date time formatter for node and browser.

# Getting started

**Browser usage** see in examples directory.

**Node usage**:

```
npm i format-date-time --save
```

```
import DateTimeFormat from 'format-date-time'

const defaultFormatter = new DateTimeFormat();

console.log(defaultFormatter.parse()); // return current date/time in default format
console.log(defaultFormatter.parse(new Date ("2017-10-02T05:05:05.985Z"), 'HH:mm:ss'));
console.log(defaultFormatter.parse("2017-10-02T08:18:31.985Z", 'HH:mm:ss (year: YYYY)')); // time string instead of Date object
console.log(defaultFormatter.now('HH:mm:ss')); // current time in specified format
console.log(defaultFormatter.now('HH:mm:ss (DD-MM-YYYY)'));
```

_or set format mask in the constructor:_

```
const formatter = new DateTimeFormat('HH:mm (YYYY-MM-DD)');
console.log(formatter.now()); // current date/time in format settled in constructor
console.log(formatter.parse(new Date ("2017-10-02T05:05:05.985Z")));
```

## Running the tests

Run test:

```
npm run test
```

Run test on Windows machine

```
npm run testWin
```

## Versioning

We use [SemVer](http://semver.org/) for versioning. 

## Authors

* **Andrii Dotsia** - *Initial work* - [andreydos](https://github.com/andreydos)

See also the list of [contributors](https://github.com/andreydos/date-time-format/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

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