Skip to content

Latest commit

 

History

History
75 lines (61 loc) · 2.18 KB

README.md

File metadata and controls

75 lines (61 loc) · 2.18 KB

next-weeks

Weeks for next.

version license size download

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.