Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lightpick

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightpick - npm Package Compare versions

Comparing version 1.2.8 to 1.2.9

3

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
[1.2.9] - 2019-01-15
* fixed bugs #28, #29, #30
[1.2.8] - 2018-12-18

@@ -5,0 +8,0 @@ * improved option `orientation` (checking available space on top when value is `auto`)

32

lightpick.js
/**
* @author: Rinat G. http://coding.kz
* @copyright: Copyright (c) 2018 Rinat G.
* @copyright: Copyright (c) 2019 Rinat G.
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php

@@ -890,6 +890,14 @@ */

this.setStartDate(opts.startDate, true);
this.setEndDate(opts.endDate, true);
if (this.getStartDate() === null && moment(this._opts.field.value, this._opts.format).isValid()) {
this._opts.startDate = moment(this._opts.field.value, this._opts.format);
}
return opts;
if (this.getEndDate() === null && this._opts.secondField && moment(this._opts.secondField.value, this._opts.format).isValid()) {
this._opts.endDate = moment(this._opts.secondField.value, this._opts.format);
}
this.setStartDate(this._opts.startDate, true);
this.setEndDate(this._opts.endDate, true);
return this._opts;
},

@@ -1024,5 +1032,6 @@

{
var date = moment(date);
var dateISO = moment(date, moment.ISO_8601),
dateOptFormat = moment(date, this._opts.format);
if (!date.isValid()) {
if (!dateISO.isValid() && !dateOptFormat.isValid()) {
this._opts.startDate = null;

@@ -1033,3 +1042,3 @@ this._opts.field.value = '';

this._opts.startDate = moment(date);
this._opts.startDate = moment(dateISO.isValid() ? dateISO : dateOptFormat);

@@ -1050,5 +1059,6 @@ if (this._opts.singleDate || this._opts.secondField) {

{
var date = moment(date);
var dateISO = moment(date, moment.ISO_8601),
dateOptFormat = moment(date, this._opts.format);
if (!date.isValid()) {
if (!dateISO.isValid() && !dateOptFormat.isValid()) {
this._opts.endDate = null;

@@ -1065,3 +1075,3 @@

this._opts.endDate = moment(date);
this._opts.endDate = moment(dateISO.isValid() ? dateISO : dateOptFormat);

@@ -1248,2 +1258,2 @@ if (this._opts.secondField) {

return Lightpick;
}));
}));
{
"name": "lightpick",
"version": "1.2.8",
"version": "1.2.9",
"description": "Javascript date range picker - lightweight, no jQuery",

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

@@ -150,3 +150,3 @@ [![npm version](https://badge.fury.io/js/lightpick.svg)](https://www.npmjs.com/package/lightpick) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wakirin/lightpick/blob/master/LICENSE)

Array of disabled dates. Array can contains ranges, allowed the same format as in options minDate, maxDate. Ex.: `\[moment().startOf('month'), \['2018-06-23', '2018-06-30'\]\]`
Array of disabled dates. Array can contains ranges, allowed the same format as in options minDate, maxDate. Eg.: `\[moment().startOf('month'), \['2018-06-23', '2018-06-30'\]\]`

@@ -177,2 +177,8 @@ ### selectForward

### hoveringTooltip
- Type: `Boolean`
- Default: `true`
Show tooltip.
### footer

@@ -190,7 +196,7 @@ - Type: `Boolean|String`

### locale
- Type: `Object`
- Default: `{ buttons: { prev: '<', next: '>', close: '×', reset: 'Reset', apply: 'Apply'}, tooltip: ['day', 'days'] }`
### tooltipNights
- Type: `Boolean`
- Default: `false`
Text for buttons, tooltip.
Calc date range in nights. (For hotels when last date doesn't include to range)

@@ -209,2 +215,34 @@ ### orientation

### locale
- Type: `Object`
- Default:
```
{
buttons: {
prev: '&leftarrow;',
next: '&rightarrow;',
close: '&times;',
reset: 'Reset',
apply: 'Apply'
},
tooltip: {
one: 'day',
other: 'days'
},
tooltipOnDisabled: null,
pluralize: function(i, locale){
if (typeof i === "string") i = parseInt(i, 10);
if (i === 1 && 'one' in locale) return locale.one;
if ('other' in locale) return locale.other;
return '';
}
}
```
`buttons` - Text for buttons
`tooltip` - Text for tooltip (one, few, many, other)
`tooltipOnDisabled` (String) - Show tooltip text on disabled dates. (Eg. «Already booked»)
`pluralize` (function) - Function for calc plural text. More examples for another locales on [betsol/numerous](https://github.com/betsol/numerous/tree/master/locales)
### onSelect

@@ -228,2 +266,9 @@ - Type: `Function`

### onError
- Type: `Function`
- Default: `null`
Working when `disabledDatesInRange: false`
Callback function for when user has select date range with disabled dates.
## Methods

@@ -236,3 +281,3 @@

Set date when singleDate is true. `date` can be moment, string, number, date.
Ex. `picker.setDate(new Date());`
Eg. `picker.setDate(new Date());`

@@ -243,3 +288,3 @@

Set date range. <code>start, end</code> can be moment, string, number, date.
Ex. `picker.setDateRange(new Date(), moment().add(7, 'day'));`
Eg. `picker.setDateRange(new Date(), moment().add(7, 'day'));`

@@ -250,3 +295,3 @@

array of disabled dates. Array can contains ranges, allowed moment, string, number, date.
Ex. `picker.setDisableDates([ moment().startOf('month'), ['2018-06-23', '2018-06-30'] ]);`
Eg. `picker.setDisableDates([ moment().startOf('month'), ['2018-06-23', '2018-06-30'] ]);`

@@ -253,0 +298,0 @@

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