├── .babelrc ├── .eslintrc ├── .gitignore ├── .npmignore ├── README.md ├── dist └── vue-daterangepicker-component.min.js ├── example.html ├── package.json └── src ├── defaultRange.js └── index.vue /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "vue", 3 | "globals": { 4 | "moment": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | *.png 4 | .git 5 | dist 6 | example 7 | node_modules 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vue Date Range Picker Component 2 | 3 | [![npm version][npm-v-img]][npm-url] 4 | [![npm download][npm-dl-img]][npm-url] 5 | 6 | > Intellectual property of [Oneway.mobi](http://www.oneway.mobi/) 7 | 8 | #### Notice 9 | This component is not meant to meet all the business requirements 10 | so diving into `src/` to make it fits your needs is highly recommended 11 | 12 | #### Example 13 | See [here](https://onewaytech.github.io/vue-daterangepicker-component/example.html), source in [`example.html`](./example.html) 14 | > Suggest inspecting it with [devtools](https://github.com/vuejs/vue-devtools) 15 | 16 | #### Requirement 17 | * Vue 1.x 18 | * Vue Router 0.7.x 19 | * [vue-update-query-mixin](https://github.com/onewaytech/vue-update-query-mixin) 20 | * Moment.js (available globally) 21 | * jQuery + BootStrap 3.x (available globally) 22 | * [`bootstrap-daterangepicker`](http://www.daterangepicker.com/) 23 | 24 | #### Installation 25 | `npm i vue-daterangepicker-component -S` 26 | 27 | > alternatively: `` 28 | > which exposes **`VueDateRangePicker`** as a global variable 29 | 30 | #### Usage 31 | ``` 32 | 33 | 34 | props: { 35 | // more options see http://www.daterangepicker.com/#options 36 | config: { type: Object, default: () => ({}) } 37 | } 38 | ``` 39 | 40 | #### Build 41 | 42 | `npm run build` 43 | 44 | #### LICENSE 45 | 46 | MIT 47 | 48 | [npm-url]: https://www.npmjs.com/package/vue-daterangepicker-component 49 | [npm-v-img]: http://img.shields.io/npm/v/vue-daterangepicker-component.svg 50 | [npm-dl-img]: http://img.shields.io/npm/dm/vue-daterangepicker-component.svg 51 | -------------------------------------------------------------------------------- /dist/vue-daterangepicker-component.min.js: -------------------------------------------------------------------------------- 1 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.VueDateRangePicker = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;oi[_v-4de4f3ca]{position:absolute;top:13px;left:15px;pointer-events:none}.-date-range>input[_v-4de4f3ca]{border:none;background-color:transparent;padding:10px 15px 10px 35px;min-width:240px}");Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t 2 | 3 | 4 | 5 | Vue Date Range Picker Component Example 6 | 7 | 8 | 9 | 10 | 11 |
12 | 15 |
16 | $route.query: {{ $route.query | json }} 17 |
18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-daterangepicker-component", 3 | "description": "Date range picker for Vue 1.x, based on bootstrap-daterangepicker", 4 | "author": "Ken Berkeley ", 5 | "version": "1.0.0", 6 | "main": "src/index.vue", 7 | "scripts": { 8 | "lint": "eslint src/", 9 | "build": "npm run lint && cross-env NODE_ENV=production browserify -s VueDateRangePicker ./ -o dist/vue-daterangepicker-component.min.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/kenberkeley/vue-daterangepicker-component.git" 14 | }, 15 | "keywords": [ 16 | "vue", 17 | "daterange", 18 | "daterangepicker", 19 | "picker" 20 | ], 21 | "dependencies": { 22 | "vue-update-query-mixin": "^1.0.4" 23 | }, 24 | "devDependencies": { 25 | "babel-cli": "^6.18.0", 26 | "babel-core": "^6.21.0", 27 | "babel-plugin-transform-runtime": "^6.15.0", 28 | "babel-preset-es2015": "^6.18.0", 29 | "babel-preset-stage-2": "^6.18.0", 30 | "babel-runtime": "^6.20.0", 31 | "babelify": "^7.3.0", 32 | "browserify": "^13.1.1", 33 | "browserify-shim": "^3.8.12", 34 | "cross-env": "^3.1.3", 35 | "eslint": "^3.12.2", 36 | "eslint-config-vue": "^2.0.1", 37 | "eslint-plugin-vue": "^1.0.0", 38 | "uglifyify": "^3.0.4", 39 | "vueify": "^8.7.0" 40 | }, 41 | "browserify": { 42 | "transform": [ 43 | "browserify-shim", 44 | "babelify", 45 | "vueify", 46 | "uglifyify" 47 | ] 48 | }, 49 | "browserify-shim": { 50 | "vue": "global:Vue" 51 | }, 52 | "license": "MIT" 53 | } 54 | -------------------------------------------------------------------------------- /src/defaultRange.js: -------------------------------------------------------------------------------- 1 | const FORMAT = 'YYYY-MM-DD' 2 | export { FORMAT } 3 | 4 | // Default range is one week 5 | export default { 6 | startDate: moment().subtract(6, 'days').startOf('day').format(FORMAT), 7 | endDate: moment().endOf('day').format(FORMAT) 8 | } 9 | -------------------------------------------------------------------------------- /src/index.vue: -------------------------------------------------------------------------------- 1 | 8 | 69 | 92 | --------------------------------------------------------------------------------