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 0.0.1 to 0.0.2

.editorconfig

12

CHANGELOG.md

@@ -1,2 +0,10 @@

0.0.1 - June 2018
- Published on Github
# Changelog
All notable changes to this project will be documented in this file.
[0.0.2] - 2018-06-16
* Add polyfill (Object.assign)
* flexbox fallback for IE
* Update docs
[0.0.1] - 2018-06-15
* Published on Github

40

demo.js

@@ -0,2 +1,8 @@

function rangeText(start, end) {
var str = '';
str += start ? start.format('Do MMMM YYYY') + ' to ' : '';
str += end ? end.format('Do MMMM YYYY') : '...';
return str;
}
// demo-1

@@ -15,6 +21,3 @@ new lightPick({

onSelect: function(start, end){
var str = '';
str += start ? start.format('Do MMMM YYYY') + ' to ' : '';
str += end ? end.format('Do MMMM YYYY') : '...';
document.getElementById('result-2').innerHTML = str;
document.getElementById('result-2').innerHTML = rangeText(start, end);
}

@@ -28,6 +31,3 @@ });

onSelect: function(start, end){
var str = '';
str += start ? start.format('Do MMMM YYYY') + ' to ' : '';
str += end ? end.format('Do MMMM YYYY') : '...';
document.getElementById('result-3').innerHTML = str;
document.getElementById('result-3').innerHTML = rangeText(start, end);
}

@@ -41,4 +41,4 @@ });

numberOfMonths: 6,
onSelect: function(date){
document.getElementById('result-4').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-4').innerHTML = rangeText(start, end);
}

@@ -53,4 +53,4 @@ });

numberOfMonths: 6,
onSelect: function(date){
document.getElementById('result-5').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-5').innerHTML = rangeText(start, end);
}

@@ -65,4 +65,4 @@ });

maxDate: moment().endOf('month').subtract(7, 'day'),
onSelect: function(date){
document.getElementById('result-6').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-6').innerHTML = rangeText(start, end);
}

@@ -76,4 +76,4 @@ });

selectForward: true,
onSelect: function(date){
document.getElementById('result-7').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-7').innerHTML = rangeText(start, end);
}

@@ -87,4 +87,4 @@ });

selectBackward: true,
onSelect: function(date){
document.getElementById('result-8').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-8').innerHTML = rangeText(start, end);
}

@@ -99,5 +99,5 @@ });

maxDays: 7,
onSelect: function(date){
document.getElementById('result-9').innerHTML = date.format('Do MMMM YYYY');
onSelect: function(start, end){
document.getElementById('result-9').innerHTML = rangeText(start, end);
}
});
/**
* @version: 0.0.1
* @version: 0.0.2
* @author: Rinat G. http://coding.kz

@@ -26,2 +26,32 @@ * @copyright: Copyright (c) 2018 Rinat G.

if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { // .length of function is 2
'use strict';
if (target == null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
var document = window.document,

@@ -274,3 +304,4 @@

updateDates = function(el, opts){
el.querySelectorAll('.day').forEach(function(day) {
var days = el.querySelectorAll('.day');
[].forEach.call(days, function(day) {
day.outerHTML = renderDay(opts, parseInt(day.getAttribute('data-time')), false, day.className.split(' '));

@@ -381,4 +412,4 @@ });

}
self.el.querySelectorAll('.day').forEach(function(day) {
var days = self.el.querySelectorAll('.day');
[].forEach.call(days, function(day) {
var dt = moment(parseInt(day.getAttribute('data-time')));

@@ -385,0 +416,0 @@

{
"name": "lightpick",
"version": "0.0.1",
"version": "0.0.2",
"description": "Javascript date range picker - lightweight, no jQuery",

@@ -5,0 +5,0 @@ "scripts": {

@@ -20,3 +20,5 @@ lightPick

`npm install lightpick`
```
npm install lightpick
```

@@ -102,3 +104,14 @@ or you can download and include Moment.js and lightPick files manually.

`picker.setDateRange(start, end)`
Set date range. <code>start, end</code> can be moment, string, number, date.
Ex. `picker.setDateRange(new Date(), moment().add(7, 'day'));`
`picker.setDisableDates(array)`
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'] ]);`
`picker.getDate()`

@@ -108,3 +121,2 @@

@@ -111,0 +123,0 @@ `picker.getStartDate()`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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