# @uiw/utils

> utils tools for uiw

Latest version **4.22.3** (published 2023-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @uiw/utils
pnpm add @uiw/utils
yarn add @uiw/utils
bun add @uiw/utils
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.22.3 |
| Published | 2023-11-29 |
| First published | 2020-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 739 |
| Author | Kenny Wong |
| Maintainers | uiwjs, wcjiang |
| Keywords | utils, react-utils, design, uiw, uiw-react, react.js, react, react-component, component, components, ui, css, uikit, react-ui, framework, front-end, frontend |

## Links

- npm: https://www.npmjs.com/package/@uiw/utils
- Repository: https://github.com/uiwjs/uiw
- Homepage: https://github.com/uiwjs/uiw/tree/master/packages/utils#readme
- Issues: https://github.com/uiwjs/uiw/issues
- Funding: https://jaywcjlove.github.io/#/sponsor
- npm.io page: https://npm.io/package/@uiw/utils

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@mesalvo/react-ui](https://npm.io/package/@mesalvo/react-ui.md) — 1.7K weekly downloads

## Recent versions

- 4.22.3 (latest) — 2023-11-29
- 5.0.0-bate.2.1 (bate) — 2023-03-10
- 4.22.2 — 2023-11-09
- 4.22.1 — 2023-11-08
- 4.22.0 — 2023-09-19
- 4.21.28 — 2023-05-05
- 4.21.27 — 2023-04-21
- 4.21.26 — 2023-04-20
- 4.21.25 — 2023-03-14
- 4.21.24 — 2023-03-08
- 5.0.0-bate.2.0 — 2023-03-02
- 4.21.23 — 2022-12-21
- 4.21.22 — 2022-12-19
- 4.21.21 — 2022-12-19
- 5.0.0-bate-19 — 2022-12-12
- … 155 more at https://npm.io/package/@uiw/utils/versions

## README

`@uiw/utils`
===

[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-utils/file/README.md)
[![NPM Downloads](https://img.shields.io/npm/dm/@uiw/react-utils.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-utils)
[![npm version](https://img.shields.io/npm/v/@uiw/react-utils.svg?label=@uiw/react-utils)](https://npmjs.com/@uiw/react-utils)

## Install

```bash
npm i @uiw/utils
```

## Usage

```js
import { isLeapYear, solarMonthDays } from '@uiw/utils';
```

### ~~isLeapYear~~

Determine whether it is a leap year

```js
const isLeapYear = (year: number) => {
  if (year % 4 === 0 && year % 100 !== 0) return true;
  else if (year % 400 === 0) return true;
  return false;
};
```

### ~~getFirstDayOfWeek~~

The first day of the month is the day of the week.

```js
new Date(2021,6,1).getDay() // => 4
```

### ~~solarMonthDays~~

Get the sun moon, commonly known as the solar calendar month By calculating the second month of the leap year, maybe `29` days

```js
new Date(2021,6,0).getDate() // => 30
```

### ~~isSameDate~~

Check if a date is the same as another date. Use `Date.prototype.toISOString()` and strict equality checking (`===`) to check if the first date is the same as the second one.

```js
new Date(2021,6,1).toISOString() === new Date(2021,6,1).toISOString() // => true
```

### getScroll

Gets the scroll value of the given element in the given side (top and left)

### randomid

```js
randomid()
// "5fan4z7qsa"
```

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