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

anytime

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anytime - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

src/anytime.d.ts

126

gulpfile.js

@@ -8,4 +8,2 @@ 'use strict'

var autoprefixer = require('gulp-autoprefixer')
, browserify = require('browserify')
, buffer = require('vinyl-buffer')
, del = require('del')

@@ -18,26 +16,35 @@ , ghPages = require('gulp-gh-pages')

, jade = require('gulp-jade')
, minifyCss = require('gulp-minify-css')
, nano = require('gulp-cssnano')
, sass = require('gulp-sass')
, st = require('st')
, rename = require('gulp-rename')
, source = require('vinyl-source-stream')
, uglify = require('gulp-uglify')
, webpack = require('webpack')
////////////////////////////////////////////////////////////////////////////////
// Paths //
// Config //
////////////////////////////////////////////////////////////////////////////////
var paths =
{ webSrcHtml: 'website/index.jade'
, webSrcJs: 'website/js/index.js'
, webSrcScss: 'website/styles/index.scss'
, webDest: 'website/build/'
, libSrcJs: 'src/anytime.js'
, libDest: 'dist/'
{ webSrcHtml: './website/index.jade'
, webSrcJs: './website/js/index.js'
, webSrcScss: './website/styles/index.scss'
, webDest: './website/build/'
, libSrcJs: './src/anytime.js'
, libDest: './dist/'
}
var webpackPlugins =
[ new webpack.optimize.DedupePlugin()
, new webpack.optimize.OccurenceOrderPlugin()
, new webpack.optimize.UglifyJsPlugin(
{ compress: { warnings: false }
, output: { comments: false }
, sourceMap: false
}
)
]
////////////////////////////////////////////////////////////////////////////////
// Gulp tasks //
// Gulp tasks for the website //
////////////////////////////////////////////////////////////////////////////////

@@ -63,3 +70,3 @@

.pipe(autoprefixer({ browsers: ['last 2 versions'] }))
.pipe(minifyCss())
.pipe(nano())
.pipe(gulp.dest(paths.webDest))

@@ -70,13 +77,15 @@ })

gulp.task('scripts', function(cb) {
browserify(paths.webSrcJs)
.bundle()
.on('error', function(err) {
console.error(err)
this.emit('end')
})
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(paths.webDest))
.on('end', cb)
webpack(
{ entry: paths.webSrcJs
, output:
{ path: paths.webDest
, filename: 'index.js'
}
, plugins: webpackPlugins
}
, function(webpack_err, stats) {
if (webpack_err) cb(webpack_err)
cb()
}
)
})

@@ -102,2 +111,13 @@

// Deploy to GitHub Pages
gulp.task('deploy', ['build:web'], function() {
return gulp.src(paths.webDest + '/**/*')
.pipe(ghPages())
})
////////////////////////////////////////////////////////////////////////////////
// Gulp tasks for the library //
////////////////////////////////////////////////////////////////////////////////
// Delete generated Anytime files

@@ -108,4 +128,3 @@ gulp.task('clean:lib', function() {

// Compile Anytime library
gulp.task('build:lib', ['clean:lib'], function(cb) {
var buildLib = function(filename, externals, cb) {
var pkg = require('./package.json')

@@ -123,29 +142,34 @@

// Bundle with Browserify
browserify(paths.libSrcJs, { standalone: 'Anytime' })
.bundle()
.on('error', function(err) {
console.error(err)
this.emit('end')
})
// Bundle with Webpack
webpack(
{ entry: paths.libSrcJs
, output:
{ path: paths.libDest
, filename: filename
, library: 'anytime'
, libraryTarget: 'umd'
}
, plugins: webpackPlugins
, externals: externals
}
, function(webpack_err, stats) {
if (webpack_err) cb(webpack_err)
// Normal file
.pipe(source('anytime.js'))
.pipe(buffer())
.pipe(header(banner, { pkg: pkg } ))
.pipe(gulp.dest(paths.libDest))
gulp.src(paths.libDest + filename)
.pipe(header(banner, { pkg: pkg } ))
.pipe(gulp.dest(paths.libDest))
.on('end', cb)
}
)
}
// Minified file
.pipe(uglify())
.pipe(rename('anytime.min.js'))
.pipe(header(banner, { pkg: pkg } ))
.pipe(gulp.dest(paths.libDest))
gulp.task('build:lib-with-moment', function(cb) {
buildLib('anytime-with-moment.js', {}, cb);
})
.on('end', cb)
gulp.task('build:lib-without-moment', function(cb) {
buildLib('anytime.js', { 'moment': 'moment' }, cb);
})
// Deploy to GitHub Pages
gulp.task('deploy', ['build:web'], function() {
return gulp.src(paths.webDest + '/**/*')
.pipe(ghPages())
})
// Compile Anytime library
gulp.task('build:lib', ['clean:lib', 'build:lib-with-moment', 'build:lib-without-moment'])
{
"name": "anytime",
"version": "1.3.0",
"version": "1.4.0",
"description": "A date/time picker",

@@ -16,2 +16,3 @@ "author": "Ben Gourley",

"main": "src/anytime.js",
"typings": "src/anytime.d.ts",
"scripts": {

@@ -32,28 +33,24 @@ "lint": "jshint . --reporter=./node_modules/jshint-full-path/index.js",

"lodash.throttle": "*",
"moment": "^2.10.3",
"pad-number": "^0.0.1"
"moment": "^2.11.1",
"pad-number": "^0.0.4"
},
"devDependencies": {
"browserify": "^12.0.1",
"del": "^2.0.2",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-gh-pages": "^0.5.2",
"gulp-gh-pages": "^0.5.4",
"gulp-cssnano": "^2.1.0",
"gulp-header": "^1.7.1",
"gulp-htmlmin": "^1.1.4",
"gulp-htmlmin": "^1.3.0",
"gulp-jade": "^1.1.0",
"gulp-minify-css": "^1.2.1",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.4",
"gulp-uglify": "^1.4.1",
"istanbul": "^0.4.0",
"jsdom": "^7.0.2",
"jshint": "^2.5.6",
"gulp-sass": "^2.1.1",
"istanbul": "^0.4.2",
"jsdom": "^7.2.2",
"jshint": "^2.9.1",
"jshint-full-path": "^1.1.1",
"mocha": "^2.3.3",
"moment-timezone": "^0.4.1",
"st": "^1.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
"mocha": "^2.3.4",
"moment-timezone": "^0.5.0",
"st": "^1.1.0",
"webpack": "^1.12.11"
}
}

@@ -9,2 +9,3 @@ module.exports = AnytimePicker

, getYearList = require('./lib/get-year-list')
, getTimeSeparator = require('./lib/get-time-separator')
, createButton = require('./lib/create-button')

@@ -23,13 +24,13 @@ , createSlider = require('./lib/create-slider')

, minuteIncrement: 1
, showTime: true
, timeSliders: false
, shortMonthNames: true
, doneText: 'Done'
, clearText: 'Clear'
, timeSliders: false
, timeSlidersTitle: 'Time:'
, timeSlidersHourTitle: 'Hour:'
, timeSliderMinuteTitle: 'Minute:'
, shortMonthNames: true
, timeSlidersText: 'Time:'
, timeSlidersHourText: 'Hour:'
, timeSlidersMinuteText: 'Minute:'
}
function AnytimePicker(options) {
this.options = extend({}, defaults, options)

@@ -51,2 +52,7 @@

this.value = this.options.initialValue ? this.createMoment(this.options.initialValue).seconds(0).milliseconds(0) : null
if (this.value && !this.options.showTime) {
this.value = this.value.hour(0).minute(0)
}
this.monthNames = this.getMonthNames()

@@ -79,3 +85,2 @@

}
}

@@ -102,3 +107,2 @@

AnytimePicker.prototype.update = function (update) {
if (update === null || update === undefined) {

@@ -118,10 +122,13 @@ this.value = null

this.value = updated
if (!this.options.showTime) {
this.value = this.value.hour(0).minute(0)
}
this.currentView = { month: this.value.month(), year: this.value.year() }
this.updateDisplay()
this.emit('change', this.value.toDate())
}
AnytimePicker.prototype.render = function () {
// Header

@@ -138,6 +145,9 @@ var header = document.createElement('div')

// Time
var time = document.createElement('div')
time.classList.add('anytime-picker__time')
time.classList.add('js-anytime-picker-time')
this.renderTimeInput(time)
var time
if (this.options.showTime) {
time = document.createElement('div')
time.classList.add('anytime-picker__time')
time.classList.add('js-anytime-picker-time')
this.renderTimeInput(time)
}

@@ -151,3 +161,3 @@ // Footer

this.el.appendChild(dates)
this.el.appendChild(time)
if (this.options.showTime) this.el.appendChild(time)
this.el.appendChild(footer)

@@ -160,7 +170,5 @@

return this
}
AnytimePicker.prototype.renderHeader = function (headerEl) {
// Previous month button

@@ -211,8 +219,6 @@ var prevBtn = createButton('<', [ 'anytime-picker__button', 'anytime-picker__button--prev' ])

nextBtn.addEventListener('click', this.showNextMonth.bind(this))
}
AnytimePicker.prototype.renderFooter = function (footerEl) {
// 'Done' button
// "Done" button
var doneBtn = createButton(this.options.doneText, [ 'anytime-picker__button', 'anytime-picker__button--done' ])

@@ -222,3 +228,3 @@ footerEl.appendChild(doneBtn)

// 'Clear' button
// "Clear" button
var clearBtn = createButton(this.options.clearText, [ 'anytime-picker__button', 'anytime-picker__button--clear' ])

@@ -230,7 +236,5 @@ footerEl.appendChild(clearBtn)

}.bind(this))
}
AnytimePicker.prototype.updateDisplay = function () {
this.monthSelect.children[this.currentView.month].selected = true

@@ -327,3 +331,3 @@ Array.prototype.slice.call(this.yearSelect.children).some(function (yearEl) {

if (this.value) {
if (this.value && this.timeEls) {
this.timeEls.hours.value = this.value.hour() + ''

@@ -334,7 +338,5 @@ this.timeEls.minutes.value = this.value.minute() + ''

}
}
AnytimePicker.prototype.show = function () {
this.root.offsetParent.appendChild(this.el)

@@ -375,7 +377,5 @@

}.bind(this))
}
AnytimePicker.prototype.hide = function () {
this.el.classList.remove('anytime-picker--is-visible')

@@ -396,3 +396,2 @@

if (this.el.parentNode) this.el.parentNode.removeChild(this.el)
}

@@ -450,3 +449,2 @@

AnytimePicker.prototype.renderTimeSelect = function (timeEl) {
var hourSelect = document.createElement('select')

@@ -494,3 +492,2 @@ hourSelect.classList.add('anytime-picker__dropdown')

this.timeEls = { hours: hourSelect, minutes: minuteSelect }
}

@@ -506,3 +503,3 @@

timeLabelEl.appendChild(timeLabelTitleEl)
timeLabelTitleEl.textContent = this.options.timeSlidersTitle
timeLabelTitleEl.textContent = this.options.timeSlidersText

@@ -529,3 +526,3 @@ var timeLabelHourEl = document.createElement('span')

, value: this.createMoment(this.options.initialValue).hours()
, title: this.options.timeSlidersHourTitle
, title: this.options.timeSlidersHourText
})

@@ -550,3 +547,3 @@

, value: this.createMoment(this.options.initialValue).minutes()
, title: this.options.timeSliderMinuteTitle
, title: this.options.timeSlidersMinuteText
})

@@ -572,10 +569,11 @@

}
}
AnytimePicker.prototype.renderTimeInput = function (timeEl) {
if (this.options.timeSliders) {
this.renderTimeSliders(timeEl)
} else {
this.renderTimeSelect(timeEl)
if (this.options.showTime) {
if (this.options.timeSliders) {
this.renderTimeSliders(timeEl)
} else {
this.renderTimeSelect(timeEl)
}
}

@@ -595,8 +593,1 @@ }

}
function getTimeSeparator() {
var colonEl = document.createElement('span')
colonEl.classList.add('anytime-picker__time-separator')
colonEl.textContent = ':'
return colonEl
}

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