npm.io
1.0.0 • Published 3 years ago

uld

Licence
MIT
Version
1.0.0
Deps
0
Size
9 kB
Vulns
0
Weekly
0

uld - User local Date

npm version npm downloads npm downloads size Docs

A fast small utility to convert a date to a user-local date.

image

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 (use npm 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.