# simple-date

> converts dates so you don't have to.

Latest version **1.1.1** (published 2015-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-date
pnpm add simple-date
yarn add simple-date
bun add simple-date
```

## 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 | 1.1.1 |
| Published | 2015-02-25 |
| First published | 2015-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | adrian reimer |
| Maintainers | areim3r |
| Keywords | simple, node, date |

## Links

- npm: https://www.npmjs.com/package/simple-date
- Repository: https://github.com/areim3r/simple-date
- Issues: https://github.com/areim3r/simple-date/issues
- npm.io page: https://npm.io/package/simple-date

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

- 1.1.1 (latest) — 2015-02-25
- 1.1.0 — 2015-02-25
- 1.0.3 — 2015-02-24
- 1.0.2 — 2015-02-24
- 1.0.1 — 2015-02-24
- 1.0.0 — 2015-02-24

## README

# simple-date
Simple, versatile Javascript date formatter that can be run in the browser or required as a module in [nodejs](https://www.npmjs.com/package/simple-date "simple-date npm package"). Takes a given date string / object and converts it to desired date format.

### install
npm install simple-date

### format
Takes 2 arguments, the string or date object you have and the desired format you want (in that order).

ex. 
```javascript
var formattedDate = simpleDate.format(your_date, desired_format);
```
### arguments
Currently takes _5_ standard date formats as first arguments and 4 desired formats as second arguments:

###### ex. first args
* __'09-07-1998'__ - (dashed format)
* __'09/07/1998'__ - (slashed format)
* __'September 07, 1998'__ - (month/day/year format) 
* __'07 September, 1998'__ - (day/month/year format)

or

* __date object__

###### ex. second args
* __'dashed'__ - ex. output: 09-07-1998
* __'slashed'__ - ex. output: 09/07/1998
* __'mdy'__ - ex. output: September 07, 1998
* __'dmy'__ - ex. output: 07 September, 1998


##### in node.js

```javascript
var simpleDate = require('simple-date');
var current_date = new Date();
var formattedDate = simpleDate.format(current_date, 'dashed');
console.log(formattedDate);   // logs current_date in dashed format: XX-XX-XXXX
```

##### in browser

```html
<script src='path/to/simple-date.js'></script>
<script>
    var current_format = '09/07/1998';
    var new_format = simpleDate(current_format, 'mdy');
    console.log(new_format);    // logs: September 07, 1998
</script>
```

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