# material-duration-picker

> React Material component for durations inspired by Material-UI Pickers

Latest version **1.4.4** (published 2021-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install material-duration-picker
pnpm add material-duration-picker
yarn add material-duration-picker
bun add material-duration-picker
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.4 |
| Published | 2021-11-16 |
| First published | 2021-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tran-simon |
| Maintainers | tran-simon |
| Keywords | react, duration, material-design, material-ui, datepicker, duration-picker, durations |

## Links

- npm: https://www.npmjs.com/package/material-duration-picker
- Repository: https://github.com/tran-simon/material-duration-picker
- Homepage: https://github.com/tran-simon/material-duration-picker#readme
- Issues: https://github.com/tran-simon/material-duration-picker/issues
- npm.io page: https://npm.io/package/material-duration-picker

## 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.4.4 (latest) — 2021-11-16
- 1.4.5-muiv5 (muiv5) — 2021-12-05
- 1.4.3 — 2021-09-28
- 1.4.2 — 2021-08-20
- 1.4.1 — 2021-06-10
- 1.4.0 — 2021-05-31
- 1.3.6 — 2021-05-28
- 1.3.4 — 2021-05-28
- 1.3.2 — 2021-05-04
- 1.3.1 — 2021-05-04
- 1.2.3 — 2021-05-03
- 1.0.1 — 2021-04-28
- 1.0.0 — 2021-04-28
- 0.1.0 — 2021-04-27

## README

# Material-Duration-Picker

Simple duration picker inspired by [Material-UI Pickers](https://material-ui-pickers.dev/)

![image](https://user-images.githubusercontent.com/8755930/116327819-96fc1280-a795-11eb-96a6-e10722fe5b56.png)


## To install

```bash
npm install --save material-duration-picker
```

or

```bash
yarn add material-duration-picker
```

### Dependencies:

* [Material-UI](https://material-ui.com/)
* [React](https://github.com/facebook/react)

## To use:

*This example uses [date-fns](https://github.com/date-fns/date-fns) to format the duration*

```typescript jsx
import {DurationPicker} from "./durationPicker";
import {formatDuration} from 'date-fns'

const Comp = () => {
  const [value, setValue] = useState(0)
  return (
    <div>
      <DurationPicker
        label='Duration'
        value={value}
        onValueChange={(v) => setValue(v)}
        formatDuration={formatDuration}
      />
    </div>
  );
}
```


[demo](https://user-images.githubusercontent.com/8755930/116327648-41c00100-a795-11eb-9446-ec7d57fae7a4.mp4)



### Props

* value: (REQUIRED) The duration value in seconds
* onValueChange: (REQUIRED) On change callback
* formatDuration: function to customize the way that the duration is formatted
* views: Array of views to offer. **MUST BE FROM BIGGEST TO SMALLEST** ex: ['weeks', 'minutes', 'seconds']
* disableEditDialog: If should not enable the edit dialog on click of the field 
* DurationDialogProps: Props passed to the dialog

Remaining props are passed to the TextField component


### Localisation

https://github.com/tran-simon/material-duration-picker/issues/1#issuecomment-870100173

[Sandbox example](https://codesandbox.io/s/material-duration-picker-translation-example-3xnps?file=/src/App.tsx:0-897)

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