# indo-formatter

> Library for Indonesia format

Latest version **1.0.4** (published 2022-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install indo-formatter
pnpm add indo-formatter
yarn add indo-formatter
bun add indo-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 | 1.0.4 |
| Published | 2022-03-30 |
| First published | 2020-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Reza Fahlevi |
| Maintainers | rezarffahlevi |
| Keywords | indonesia, formatter |

## Links

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

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2022-03-30
- 1.0.3 — 2020-03-12
- 1.0.2 — 2020-02-18
- 1.0.1 — 2020-02-18
- 1.0.0 — 2020-02-18

## README

# indo-formatter

NPM https://www.npmjs.com/package/indo-formatter

GIT https://github.com/rezarffahlevi/indo-formatter

Available:
- Rupiah format
- Writing numbers (does not support commas)
- Indonesian date format
- Initial capital
- Relative time

Version 1.0.3

# Import

```jsx

const idf = require('indo-formatter');

//Or

const {toTerbilang, toUcFirst, toRupiah, toTanggal} = require('indo-formatter');

//ES6

import idf, { toTerbilang, toUcFirst, toRupiah, toTanggal } from 'indo-formatter';
```

# Example

```jsx
// with default

idf.toUcFirst(idf.toTerbilang(10000)); //Sepuluh ribu
idf.toTanggal() //Selasa, 18 februari 2020 (Hari ini)


// with import function

toTerbilang(2513) //dua ribu lima ratus tiga belas

toUcFirst(toTerbilang(2513)) //Dua ribu lima ratus tiga belas

toRupiah(10000) //Rp. 10.000,00

toRupiah(10000, false) // Rp. 10.000

toTanggal() // Selasa, 18 februari 2020 (today)

toTanggal('2020-02-17') // Senin, 17 februari 2020

toTanggal('10/21/2012', 'l') // 21 okt 2012


// Assumption is now on March 12, 2020 at 10:30

fromNow('03-04-2020 20:10:00'); // 8 hari yang lalu

fromNow(1583983217435); // 16 menit lagi

fromNow('2021-02-17'); // sekitar 2 tahun lagi

fromNow('2018-02-17'); // sekitar 2 tahun yang lalu
```

# Available Props

| Name                           | Params Type             | Default                        | Description                                                                                                                                |
| ------------------------------ | ---------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| toTerbilang(param)             | string or int    | none (required)                | Writing numbers (does not support commas), support until 10^62
| toRupiah(param, format)        | string or int, boolean    | none (required), default format is true | For rupiah format. param must be string or int, and format must be boolean. if true rupiah with commas and if false rupiah only
| toTanggal(date, format)        | string or int or timestamp | today                | For Indonesia format date. Date must be string or date with format('YYYY-MM-DD') or format('DD-MM-YYYY') or New Date(); and format default is 'L' if the value format is 'l' so will be return format date Indonesia without day.
| toUcFirst(param)              | string                    | none (required)        | For initial capitalize. param must be string; support until 10^62
| fromNow(param)                | string or int or timestamp | none (required) | For relative time, future or past

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