1.1.2 • Published 4 years ago

pnt v1.1.2

Weekly downloads
15
License
MIT
Repository
github
Last release
4 years ago

Install

npm install pnt -S

How to use

date(日期工具类)

  • getDate(showZero, sep) 获取当前日期
属性类型默认值必填说明
showZeroBooleantrue是否自动补 0
sepString-分隔符
  • getTime(showZero, sep) 获取当前时间
属性类型默认值必填说明
showZeroBooleantrue是否自动补 0
sepString:分隔符
  • getDateAndTime(showZero, dsep, tse) 获取日期和时间
属性类型默认值必填说明
showZeroBooleantrue是否自动补 0
dsepString-日期分隔符
tseString:时间分隔符
  • getWeek(prefix) 获取星期
属性类型默认值必填说明
prefixString星期前缀
  • getCountDown(ts) 获取现在到未来某一时间戳的倒计时
属性类型默认值必填说明
tsNumber未来某一时刻的时间戳

examples

import { date } from "pnt";
console.log(date.getDate(true, "-")); //2020-09-15
console.log(date.getDate(false, "/")); //2020/9/15

console.log(date.getTime(true, ":")); //18:51:06
console.log(date.getTime(false, " ")); //18 51 6

console.log(date.getDateAndTime(true, "-", ":")); //2020-09-15 18:51:07
console.log(date.getDateAndTime(false, "-", ":")); //2020-9-15 18:51:7
console.log(date.getDateAndTime(false, "/", " ")); //2020/9/15 18 51 7

console.log(date.getWeek("")); //星期三
console.log(date.getWeek("礼拜")); //礼拜三
console.log(date.getWeek("星期")); //星期三
console.log(date.getWeek("周")); //周三

console.log(date.getCountDown(1602727200000)); //3天12时20秒

utils(其他工具类)

  • getQueryByUrl(url) 获取 url 中 query 参数对象
属性类型默认值必填说明
urlString完整 url 路径
  • thousandBitSeparator(n) 给当前数字添加千分位分隔符
属性类型默认值必填说明
nNumber添加千分位分隔符的数字

examples

import { utils } from "pnt";
console.log(utils.getQueryByUrl("https://iiter.cn/user?a=peanut&b=true$c=123")); //{ a: "peanut", b: true, c: 123 };
console.log(utils.thousandBitSeparator(9999999)); // "9,999,999"
1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.0

7 years ago