Comparing version 0.1.0-iron-1 to 0.1.0-iron-2
{ | ||
"name": "alga-js", | ||
"version": "0.1.0-iron-1", | ||
"version": "0.1.0-iron-2", | ||
"description": "Alga.js is a JavaScript helper to help build UI components by using any of modern web frameworks or libraries", | ||
@@ -5,0 +5,0 @@ "module": "./dist/alga.min.js", |
@@ -6,3 +6,3 @@ import type { IsDate } from './dateType' | ||
const commonDays: number[] = [28, 29, 30, 31] | ||
const numOfDays: number = Number(new Date(Date.UTC(Number(yearNum), Number(monthNum), 0)).getUTCDate()) | ||
const numOfDays: number = Number(new Date(yearNum, monthNum, 0).getDate()) | ||
return (commonDays.includes(numOfDays)) ? numOfDays : 31 | ||
@@ -13,5 +13,5 @@ } | ||
const prevDays: number[] = [] | ||
const getDays: number = Number(new Date(Date.UTC(yearNum, Number(monthNum) - 1, 1)).getUTCDay()) | ||
const getDays: number = Number(new Date(yearNum, Number(monthNum) - 1, 1).getDay()) | ||
for(let i = Number(getDays) - 1; i >= 0; i--) { | ||
prevDays.push(Number(new Date(Date.UTC(yearNum, Number(monthNum) - 1, Number('-'+i))).getUTCDate())) | ||
prevDays.push(Number(new Date(yearNum, Number(monthNum) - 1, Number('-'+i)).getDate())) | ||
} | ||
@@ -22,4 +22,6 @@ return prevDays | ||
export const daysOfNextMonth = (yearNum: number = getYearHelper(), monthNum: number = getMonthHelper()): number => { | ||
const getDays: number = Number(new Date(Date.UTC(yearNum, Number(monthNum) - 1, daysInMonth(yearNum, monthNum))).getUTCDay()) | ||
return (6 - Number(getDays)) + 7 | ||
const getDays: number = Number(new Date(yearNum, Number(monthNum) - 1, daysInMonth(yearNum, monthNum)).getDay()) | ||
const nextMonthDays = 6 - Number(getDays) | ||
const totalMonthDays = Number(daysInMonth(yearNum, monthNum)) + Number(daysOfPrevMonth(yearNum, monthNum).length) + Number(nextMonthDays) | ||
return Number(nextMonthDays) + (42 - Number(totalMonthDays)) | ||
} | ||
@@ -26,0 +28,0 @@ |
@@ -13,5 +13,5 @@ // Taking random number between two numbers | ||
// and check if the randVal is below minVal, if yes, then return minVal as a result | ||
// and check if the randVal is less than minVal, then calculate between minVal and randVal | ||
if(randVal <= minVal) { | ||
randVal = minVal | ||
randVal = Number(minVal) + Number(randVal) | ||
} | ||
@@ -18,0 +18,0 @@ |
274552
176
3742