0.5.8 • Published 3 years ago

almoment v0.5.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Almoment


Lightweight moment.js alternative

Installation

npm install almoment

Usage

import { format } from "almoment"
const stringDate = "Sun Aug 07 2021 12:18:37 GMT+0500 (Uzbekistan Standard Time)"
const formattedDate = format(stringDate, "DD-MM-YYYY")
console.log(formattedDate)
// Output: 07-08-2021

const formattedTime = format(stringDate, "hh:mm:ss")
console.log(formattedTime)
// Output: 12:18:37

const mixedFormat = format(stringDate, "hh:mm/ss YYYY/MM/DD")
console.log(mixedFormat)
// Output: 12:18/37 2021/08/07

It will replace string with value. Value is always two digit (for example August is not '8' but '08'). If you want single digit, pass single letter (for hours - 'h'). Plus if you want to get last 2 digits of year, pass "YY" | String | definition | | ------ | ------ | | hh | hours (to get single digit -'h', the same for belows) | | mm | minutes | | ss | seconds | | DD | days | | MM | months | | YYYY | years (to get last two digits - 'YY')

License

MIT

0.5.8

3 years ago

0.5.7

3 years ago

0.5.3

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.1.31

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago