Skip to content

Latest commit

 

History

History

utils

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

使用 我的应用 也是一种 支持 我的方式:
DockLift: 点击 Dock 应用窗口回到当前屏幕 Zipora: Zip/RAR/7Z 解压工具 Scap: Screenshot & Markup Edit Screen Test Deskmark Keyzer Vidwall Hub VidCrop Vidwall Mousio Hint Mousio Musicer Audioer FileSentinel FocusCursor Videoer KeyClicker DayBar Iconed Menuist Quick RSS Quick RSS Web Serve Copybook Generator DevTutor for SwiftUI RegexMate Time Passage Iconize Folder Textsound Saver Create Custom Symbols DevHub Resume Revise Palette Genius Symbol Scribe

@uiw/utils

Buy me a coffee Telegram Channel Follow On X Open in unpkg NPM Downloads npm version

Install

npm i @uiw/utils

Usage

import { isLeapYear, solarMonthDays } from '@uiw/utils';

isLeapYear

Determine whether it is a leap year

const isLeapYear = (year: number) => {
  if (year % 4 === 0 && year % 100 !== 0) return true;
  else if (year % 400 === 0) return true;
  return false;
};

getFirstDayOfWeek

The first day of the month is the day of the week.

new Date(2021,6,1).getDay() // => 4

solarMonthDays

Get the sun moon, commonly known as the solar calendar month By calculating the second month of the leap year, maybe 29 days

new Date(2021,6,0).getDate() // => 30

isSameDate

Check if a date is the same as another date. Use Date.prototype.toISOString() and strict equality checking (===) to check if the first date is the same as the second one.

new Date(2021,6,1).toISOString() === new Date(2021,6,1).toISOString() // => true

getScroll

Gets the scroll value of the given element in the given side (top and left)

randomid

randomid()
// "5fan4z7qsa"