leomaster

EmojiClocks, DayPeriods, Weekdays, Months, Quarters Compact

Oct 23rd, 2017 (edited)
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Object.assign(Date, {
  2.     emojiclocks: [11,...Array(23).keys()].map(c=>String.fromCodePoint(128336+c%12))
  3. }, {
  4.     dayperiods: ` ${['',...
  5.     'evening afternoon morning night'
  6.         .split(/ /)].copyWithin(0,4).join(' ')} `
  7.         .replace(/\w+ /g, (w, i) => w.repeat(i / 7 + 3))
  8.         .match(/\w+/g)
  9.         .reverse()
  10.         .slice(1)
  11. }, {
  12.     weekdays: ['', ...[...Array(7).keys()].map(weekday => new Date(2e3, 1, weekday).toLocaleString('en', ({
  13.         weekday: 'long'
  14.     })))]
  15. }, {
  16.     months: ['', ...[...Array(12).keys()].map(month => new Date(2e3, month).toLocaleString('en', ({
  17.         month: 'long'
  18.     })))]
  19. }, {
  20.     quarters: /../g [Symbol.match]
  21.     `thstndrd`.reduce((acc, itr, idx, arr) => ({
  22.         ...acc,
  23.         [`q${++idx}`]: `${idx}${arr[(idx-20)%10] || arr[idx] || arr[0]} Quarter`
  24.     }), {})
  25. });
Add Comment
Please, Sign In to add comment