Package Exports
- @uiw/utils
- @uiw/utils/cjs/index.js
- @uiw/utils/esm/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 (@uiw/utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@uiw/utils
Install
npm i @uiw/utilsUsage
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() // => 4solarMonthDays
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() // => 30isSameDate
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() // => truegetScroll
Gets the scroll value of the given element in the given side (top and left)
randomid
randomid()
// "5fan4z7qsa"