Package Exports
- @jswork/next-weeks
- @jswork/next-weeks/dist/index.esm.js
- @jswork/next-weeks/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jswork/next-weeks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
next-weeks
Weeks for next.
installation
npm install -S @jswork/next-weeks
apis
api | params | description |
---|---|---|
at | (index, type) | Get en/cn/emoji by index(0-6). |
day | (day, type) | Get en/cn/emoji by js date day.(1,2,3,4,5,6,0) |
usage
import NxWeeks from '@jswork/next-weeks';
// at:
NxWeeks.at(0, 'en') // 'Monday'
NxWeeks.at(1, 'en') // 'Tuesday'
NxWeeks.at(2, 'en') // 'Wednesday'
NxWeeks.at(3, 'en') // 'Thursday'
NxWeeks.at(4, 'en') // 'Friday'
NxWeeks.at(5, 'en') // 'Saturday'
NxWeeks.at(6, 'en') // 'Sunday'
// day:
const d1 = new Date('2020-11-23');
const d2 = new Date('2020-11-24');
const d3 = new Date('2020-11-25');
const d4 = new Date('2020-11-26');
const d5 = new Date('2020-11-27');
const d6 = new Date('2020-11-28');
const d7 = new Date('2020-11-29');
// number or date instance
NxWeeks.day(d1.getDay(), 'cn') // '一'
NxWeeks.day(d2.getDay(), 'cn') // '二'
NxWeeks.day(d3.getDay(), 'cn') // '三'
NxWeeks.day(d4, 'cn') // '四'
NxWeeks.day(d5, 'cn') // '五'
NxWeeks.day(d6, 'cn') // '六'
NxWeeks.day(d7, 'cn') // '日'
emoji
- 周一(Mon) 😝
- 周二(Tue) 😪
- 周三(Wed) 😭
- 周四(Thur) 🤪
- 周五(Fri) 🤣
- 周六(Sat) 😎
- 周日(Sun) 😂
license
Code released under the MIT license.