# @zach-shearer/dates-library

> This utility library makes it easy to work with dates.

Latest version **1.1.0** (published 2022-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zach-shearer/dates-library
pnpm add @zach-shearer/dates-library
yarn add @zach-shearer/dates-library
bun add @zach-shearer/dates-library
```

## 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.0 |
| Published | 2022-09-21 |
| First published | 2022-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 83.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Zach Shearer |
| Maintainers | zach-shearer |

## Links

- npm: https://www.npmjs.com/package/@zach-shearer/dates-library
- npm.io page: https://npm.io/package/@zach-shearer/dates-library

## Recent versions

- 1.1.0 (latest) — 2022-09-21
- 1.0.4 — 2022-09-02
- 1.0.3 — 2022-09-02
- 1.0.2 — 2022-09-02
- 1.0.1 — 2022-09-02
- 1.0.0 — 2022-09-02

## README

# Dates Library

This utility library makes it easy to work with dates.

<!-- > -->

## Installation

```bash
npm install @zach-shearer/dates-library
```

<!-- > -->

## Class Atributes

```JS
D.year // 2022
D.yr // 22
D.month // September
D.mon // Sep
D.day // Thursday
D.dy // Thu
D.date // 1
D.hours // 8
D.mins // 7
D.secs // 32
```

## Class Functionality


### format()
```JS
const d = new D('9/1/2022')

d.format('M D, Y') // September 1, 2022
d.format('m d, y') // Sep 01, 22
```

| Letter | Return               | Example     |
| ------ | -------------------- | ----------- |
| Y      | Full year            | `2022`      |
| y      | Short year           | `22`        |
| M      | Full Month           | `September` |
| m      | Short Month          | `Sep`       |
| D      | Day of month         | `2`         |
| d      | Day of month padded  | `02`        |
| H      | Hour of day          | `7`         |
| h      | Hour of day padded   | `07`        |
| I      | Minute of day        | `2`         |
| i      | Minute of day padded | `02`        |
| S      | Second of day        | `5`         |
| s      | Second of day padded | `05`        |

### when()
```JS
const middleOfSeptember = new D('9/15/2022')
const beginningOfJuly = new D('7/1/2022')

middleOfSeptember.when() // 14 day(s) from now
beginningOfJuly.when() // 2 month(s) ago
```

---
_Source: https://npm.io/package/@zach-shearer/dates-library · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
