uld
v1.0.0
Published
A fast utility to convert date to user local time
Downloads
1
Readme
uld - User local Date
A fast small utility to convert a date to a user-local date.
Usage
Install package:
# npm
npm install uld
# yarn
yarn install uld
# pnpm
pnpm install uld
Import:
// ESM
import { dateConverter } from 'uld'
const { year, month, day, hour, minute, second,localDate } = dateConverter(new Date()) //you can use any date ethier as a string or a data object
// CommonJS
const { dateConverter } = require('uld')
const { year, month, day, hour, minute, second, localDate } = dateConverter(new Date()) //you can use any date ethier as a string or a data object
// use the any of the above variables to display the date to your user in their local timezone
| Prop | usage | type | default | | :-------- | :-----------------------------------------------------------------------------------------------------------: | ------- | ------- | | date | The original date to be converted | string or Date | undefined | | local | The language of the output date (optional)| string | 'en' |
💻 Development
- Clone this repository
- Enable Corepack using
corepack enable
(usenpm i -g corepack
for Node.js < 16.10) - Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
License
Made with 💛
Published under MIT License.