# strftime-js

> Method that enable formatted output(like strftime in Python) from date instance.

Latest version **0.0.2** (published 2020-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install strftime-js
pnpm add strftime-js
yarn add strftime-js
bun add strftime-js
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-11-28 |
| First published | 2020-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | pei.fan |
| Maintainers | azurewarth |
| Keywords | date, strftime, JavaScript strftime, formatted |

## Links

- npm: https://www.npmjs.com/package/strftime-js
- Repository: https://github.com/Azurewarth0920/strftime-js
- Homepage: https://github.com/Azurewarth0920/strftime-js#readme
- Issues: https://github.com/Azurewarth0920/strftime-js/issues
- npm.io page: https://npm.io/package/strftime-js

## 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.0.2 (latest) — 2020-11-28
- 0.0.1 — 2020-11-28

## README

# strftime-js

Method that enable formatted output(like strftime in Python) from date instance.

## Installation

Use yarn

```bash
yarn add strftime-js
```

or npm

```bash
npm install strftime-js
```

## Usage

### Patch method to instance

```JavaScript
import { patchInstance } from 'data-formatter'

const instance = new Date()
console.log(patchInstance(instance).toFormatted('Today is %x')) // -> Today is 1/1/2020
```

### Patch method to constructor

```JavaScript
import { patch } from 'data-formatter'

patch()
const instance = new Date()
console.log(instance.toFormatted('Today is %x')) // -> Today is 1/1/2020
```

## Reference

| Code | Meaning                                                                                                                                                              | Example                  |
| ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| %a   | Weekday as abbreviated name.                                                                                                                                         | Mon                      |
| %A   | Weekday as full name.                                                                                                                                                | Monday                   |
| %w   | Weekday as a decimal number, where 0 is Sunday and 6 is Saturday.                                                                                                    | 1                        |
| %d   | Day of the month.                                                                                                                                                    | 30                       |
| %b   | Month as abbreviated name.                                                                                                                                           | Sep                      |
| %B   | Month as full name.                                                                                                                                                  | September                |
| %m   | Month as a decimal number, where 0 is January and 11 is December.                                                                                                    | 9                        |
| %y   | Year without century as a decimal number.                                                                                                                            | 13                       |
| %Y   | Year with century as a decimal number.                                                                                                                               | 2013                     |
| %H   | Hour (24-hour clock) as a decimal number.                                                                                                                            | 07                       |
| %I   | Hour (12-hour clock) as a decimal number.                                                                                                                            | 07                       |
| %p   | Locale’s equivalent of either AM or PM.                                                                                                                              | AM                       |
| %M   | Minute as a decimal number.                                                                                                                                          | 06                       |
| %S   | Second as a decimal number.                                                                                                                                          | 05                       |
| %j   | Day of the year as a decimal number.                                                                                                                                 | 273                      |
| %U   | Week number of the year (Sunday as the first day of the week) as a decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. | 39                       |
| %W   | Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. | 39                       |
| %c   | Locale’s appropriate date and time representation.                                                                                                                   | Mon Sep 30 07:06:05 2013 |
| %x   | Locale’s appropriate date representation.                                                                                                                            | 09/30/13                 |
| %X   | Locale’s appropriate time representation.                                                                                                                            | 07:06:05                 |
| %%   | A literal '%' character.                                                                                                                                             | %                        |

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