New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gah-datepicker

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gah-datepicker - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

60

functions.js

@@ -115,46 +115,28 @@ import React from 'react';

}
var GetNextDay = {
J:([year,month,day])=>{
var monthDaysLength = GetMonthDaysLength.J(year,month,this.type);
if(day < monthDaysLength){day++;}
else if(day === monthDaysLength){
month++; day = 1;
if(month > 12){month = 1; year++;}
}
else{alert('error');}
export function getNextDay([year,month,day],type){
var monthDaysLength = getMonthDaysLength(year,month,type);
if(day < monthDaysLength){return [year,month,day + 1]}
if(month < 12){return [year,month + 1,1]}
return [year + 1,1,1];
}
export function getPrevDay([year,month,day],type){
if(day > 1){return [year,month,day - 1]}
if(month > 1){
month -= 1;
day = getMonthDaysLength(year,month,type);
return [year,month,day];
},
G:([year,month,day])=>{
var day = new Date(year,month,day);
var nextDay = new Date(day);
nextDay.setDate(day.getDate() + 1);
return [nextDay.getFullYear(),nextDay.getMonth() + 1,nextDay.getDate()]
}
}
export function getNextDay(date,type){
return GetNextDay[type](date)
}
var GetPrevDay = {
J:([year,month,day])=>{
if(day > 1){day--;}
else{
month--;
if(month === 0){
month = 12;
year--;
}
day = GetMonthDaysLength.J(year,month);
}
year -= 1;
month = 12;
day = getMonthDaysLength(year,month,type);
return [year,month,day];
},
G:([year,month,day])=>{
var day = new Date(year,month,day);
var prevDay = new Date(day);
prevDay.setDate(day.getDate() - 1);
return [nextDay.getFullYear(),nextDay.getMonth() + 1,nextDay.getDate()]
}
}
export function getPrevDay(date,type){
return GetPrevDay[type](date)
export function getNextMonth([year,month]){
if(month < 12){return [year,month + 1,1]}
return [year + 1,1,1];
}
export function getPrevMonth([year,month]){
if(month > 1){return [year,month - 1,1]}
return [year - 1,12,1];
}
function getDatesBetween(start,end){

@@ -161,0 +143,0 @@ let Start,End;

@@ -322,17 +322,49 @@ "use strict";

}, {
key: "setNextDay",
value: function setNextDay() {
var range = this.props.range;
key: "getNextDate",
value: function getNextDate(dateArray, sign, type) {
var newDate;
if (sign === 1) {
if (type === 'day') {
newDate = (0, _functions.getNextDay)(dateArray, this.mode);
} else if (type === 'month') {
newDate = (0, _functions.getNextMonth)(dateArray, this.mode);
} else {
newDate = [dateArray[0] + 1, 1, 1];
}
} else {
if (type === 'day') {
newDate = (0, _functions.getPrevDay)(dateArray, this.mode);
} else if (type === 'month') {
newDate = (0, _functions.getPrevMonth)(dateArray, this.mode);
} else {
newDate = [dateArray[0] - 1, 1, 1];
}
}
return newDate;
}
}, {
key: "setNext",
value: function setNext(sign) {
var _this$props5 = this.props,
range = _this$props5.range,
type = _this$props5.type;
var activeRange = this.state.activeRange;
var dateArray;
if (range) {
var activeRange = this.state.activeRange;
var dateObj = this.state[activeRange];
var dateArray = [dateObj.year, dateObj.month, dateObj.day];
var newDate = (0, _functions.getNextDay)(dateArray, this.mode);
var newDateObj = {
year: newDate[0],
month: newDate[1],
day: newDate[2]
};
this.SetState(_defineProperty({}, activeRange, newDateObj), true);
dateArray = [dateObj.year, dateObj.month, dateObj.day];
var date = this.getNextDate(dateArray, sign, type);
if (date[0] < this.startYear || date[1] > this.endYear) {
return;
}
this.SetState(_defineProperty({}, activeRange, {
year: date[0],
month: date[1],
day: date[2]
}), true);
} else {

@@ -343,43 +375,15 @@ var _this$state3 = this.state,

day = _this$state3.day;
dateArray = [year, month, day];
var _newDate = (0, _functions.getNextDay)([year, month, day], this.mode);
var _date = this.getNextDate(dateArray, sign, type);
var _newDateObj = {
year: _newDate[0],
month: _newDate[1],
day: _newDate[2]
};
this.SetState(_newDateObj, true);
}
}
}, {
key: "setPrevDay",
value: function setPrevDay() {
var range = this.props.range;
if (_date[0] < this.startYear || _date[0] > this.endYear) {
return;
}
if (range) {
var activeRange = this.state.activeRange;
var dateObj = this.state[activeRange];
var dateArray = [dateObj.year, dateObj.month, dateObj.day];
var newDate = (0, _functions.getPrevDay)(dateArray, this.mode);
var newDateObj = {
year: newDate[0],
month: newDate[1],
day: newDate[2]
};
this.SetState(_defineProperty({}, activeRange, newDateObj), true);
} else {
var _this$state4 = this.state,
year = _this$state4.year,
month = _this$state4.month,
day = _this$state4.day;
var _newDate2 = (0, _functions.getPrevDay)([year, month, day], this.mode);
var _newDateObj2 = {
year: _newDate2[0],
month: _newDate2[1],
day: _newDate2[2]
};
this.SetState(_newDateObj2, true);
this.SetState({
year: _date[0],
month: _date[1],
day: _date[2]
}, true);
}

@@ -390,11 +394,11 @@ }

value: function getValue() {
var _this$props5 = this.props,
range = _this$props5.range,
splitter = _this$props5.splitter,
type = _this$props5.type;
var _this$props6 = this.props,
range = _this$props6.range,
splitter = _this$props6.splitter,
type = _this$props6.type;
if (range) {
var _this$state5 = this.state,
start = _this$state5.start,
end = _this$state5.end;
var _this$state4 = this.state,
start = _this$state4.start,
end = _this$state4.end;

@@ -414,6 +418,6 @@ if (type === 'day') {

} else {
var _this$state6 = this.state,
year = _this$state6.year,
month = _this$state6.month,
day = _this$state6.day;
var _this$state5 = this.state,
year = _this$state5.year,
month = _this$state5.month,
day = _this$state5.day;

@@ -440,5 +444,5 @@ if (type === 'day') {

var _this$props6 = this.props,
jalali = _this$props6.jalali,
range = _this$props6.range;
var _this$props7 = this.props,
jalali = _this$props7.jalali,
range = _this$props7.range;
this.getDateDetails();

@@ -456,3 +460,2 @@ var Value = this.getValue();

animate: true,
open: true,
className: "gah-datepicker-button",

@@ -482,3 +485,3 @@ text: Value,

onClick: function onClick() {
return _this3.setNextDay();
return _this3.setNext(1);
}

@@ -488,3 +491,3 @@ }), /*#__PURE__*/_react.default.createElement("div", {

onClick: function onClick() {
return _this3.setPrevDay();
return _this3.setNext(-1);
}

@@ -524,11 +527,11 @@ })));

value: function isDisabled(date) {
var _this$props7 = this.props,
limits = _this$props7.limits,
splitter = _this$props7.splitter,
range = _this$props7.range,
start = _this$props7.start,
end = _this$props7.end,
activeRange = _this$props7.activeRange,
mode = _this$props7.mode,
type = _this$props7.type;
var _this$props8 = this.props,
limits = _this$props8.limits,
splitter = _this$props8.splitter,
range = _this$props8.range,
start = _this$props8.start,
end = _this$props8.end,
activeRange = _this$props8.activeRange,
mode = _this$props8.mode,
type = _this$props8.type;

@@ -644,7 +647,7 @@ if (range) {

value: function getHeader() {
var _this$props8 = this.props,
range = _this$props8.range,
size = _this$props8.size,
type = _this$props8.type,
mode = _this$props8.mode;
var _this$props9 = this.props,
range = _this$props9.range,
size = _this$props9.size,
type = _this$props9.type,
mode = _this$props9.mode;
var style = {

@@ -659,6 +662,6 @@ height: size / 8 + 6,

} else {
var _this$props9 = this.props,
activeRange = _this$props9.activeRange,
setActiveRange = _this$props9.setActiveRange,
rangeDetails = _this$props9.rangeDetails;
var _this$props10 = this.props,
activeRange = _this$props10.activeRange,
setActiveRange = _this$props10.setActiveRange,
rangeDetails = _this$props10.rangeDetails;
var _rangeDetails$start = rangeDetails.start,

@@ -707,6 +710,6 @@ year1 = _rangeDetails$start.year,

value: function getBody() {
var _this$props10 = this.props,
listView = _this$props10.listView,
details = _this$props10.details,
activeRange = _this$props10.activeRange;
var _this$props11 = this.props,
listView = _this$props11.listView,
details = _this$props11.details,
activeRange = _this$props11.activeRange;

@@ -729,8 +732,8 @@ if (listView) {

var _this$props11 = this.props,
onSubmit = _this$props11.onSubmit,
onClose = _this$props11.onClose,
mode = _this$props11.mode,
disabled = _this$props11.disabled,
size = _this$props11.size;
var _this$props12 = this.props,
onSubmit = _this$props12.onSubmit,
onClose = _this$props12.onClose,
mode = _this$props12.mode,
disabled = _this$props12.disabled,
size = _this$props12.size;
var buttonStyle = {

@@ -776,11 +779,11 @@ padding: "".concat(size / 24, "px ").concat(size / 12, "px")

value: function render() {
var _this$props12 = this.props,
_this$props12$theme = _this$props12.theme,
theme = _this$props12$theme === void 0 ? 'theme1' : _this$props12$theme,
className = _this$props12.className,
id = _this$props12.id,
style = _this$props12.style,
_this$props12$default = _this$props12.defaultProps,
defaultProps = _this$props12$default === void 0 ? {} : _this$props12$default,
years = _this$props12.years;
var _this$props13 = this.props,
_this$props13$theme = _this$props13.theme,
theme = _this$props13$theme === void 0 ? 'theme1' : _this$props13$theme,
className = _this$props13.className,
id = _this$props13.id,
style = _this$props13.style,
_this$props13$default = _this$props13.defaultProps,
defaultProps = _this$props13$default === void 0 ? {} : _this$props13$default,
years = _this$props13.years;
var context = { ...this.props,

@@ -898,3 +901,4 @@ isDisabled: this.isDisabled.bind(this),

range = _this$context2.range,
activeRange = _this$context2.activeRange;
activeRange = _this$context2.activeRange,
type = _this$context2.type;
var details = this.props.details;

@@ -907,2 +911,9 @@

if (type === 'month') {
day = 1;
} else if (type === 'year') {
day = 1;
month = 1;
}
if (range) {

@@ -950,5 +961,15 @@ SetState(_defineProperty({}, activeRange, {

var todayText = {
J: 'امروز',
G: 'Today'
}[mode];
day: {
J: 'امروز',
G: 'Today'
},
month: {
J: 'ماه جاری',
G: 'This Month'
},
year: {
J: 'سال جاری',
G: 'This Year'
}
}[type][mode];
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {

@@ -1090,5 +1111,5 @@ className: "rdp-list-header",

var mode = this.context.mode;
var _this$state7 = this.state,
activeYear = _this$state7.activeYear,
activeMonth = _this$state7.activeMonth;
var _this$state6 = this.state,
activeYear = _this$state6.activeYear,
activeMonth = _this$state6.activeMonth;
var firstDayWeekDayIndex = (0, _functions.getWeekDay)([activeYear, activeMonth, 1], mode).index;

@@ -1185,5 +1206,5 @@ var Spaces = [];

var _this$state8 = this.state,
activeYear = _this$state8.activeYear,
activeMonth = _this$state8.activeMonth;
var _this$state7 = this.state,
activeYear = _this$state7.activeYear,
activeMonth = _this$state7.activeMonth;
var _this$context6 = this.context,

@@ -1327,5 +1348,5 @@ isDisabled = _this$context6.isDisabled,

var details = this.props.details;
var _this$state9 = this.state,
activeYear = _this$state9.activeYear,
activeMonth = _this$state9.activeMonth;
var _this$state8 = this.state,
activeYear = _this$state8.activeYear,
activeMonth = _this$state8.activeMonth;

@@ -1374,5 +1395,5 @@ if (value === 1) {

type = _this$context9.type;
var _this$state10 = this.state,
activeYear = _this$state10.activeYear,
activeMonth = _this$state10.activeMonth;
var _this$state9 = this.state,
activeYear = _this$state9.activeYear,
activeMonth = _this$state9.activeMonth;
var sign = {

@@ -1379,0 +1400,0 @@ J: -1,

{
"name": "gah-datepicker",
"version": "1.1.0",
"version": "1.2.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc