<commit_before>'use strict';
	/*
	To use rangepicker prepend following snippet to index.html.tpl
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/jquery.min.js"></sc' + 'ript>');
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/jquery-ui.min.js"></sc' + 'ript>');
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/moment.min.js"></sc' + 'ript>');
	document
	.write('<scr' +
	'ipt data-spa crossorigin defer src="/js/jquery.comiseo.daterangepicker.js"></sc' + 'ript>');
	*/
var _ = require('mano').i18n.bind('Daterange')
  , dateFrom = require('./select-date-from')
  , dateTo = require('./select-date-to')
  , moment = window.moment
  , jQuery = window.jQuery;

module.exports = function (/* opts */) {
	var opts = Object(arguments[0]);

	var dateToString = function (date) {
		return moment(date).format('YYYY-MM-DD').toString();
	};

	var stringToDate = function (string) {
		return moment(string).toDate();
	};

	setTimeout(function () {
		if (!jQuery) {
			console.error('Probably you will have to integrate JQuery and all ' +
				'rangepicker dependencies into into index.html.tpl file. ' +
				'Check select-date-range.js for instructions.');
		}
		var elem = jQuery('[rangepicker]');
		elem.daterangepicker({
			presetRanges: [{
				text: _('Today'),
				dateStart: function () {
					return moment();
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Yesterday'),
				dateStart: function () {
					return moment().subtract('days', 1);
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Week to date'),
				dateStart: function () {
					return moment().startOf('week');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Month to date'),
				dateStart: function () {
					return moment().startOf('month');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Last month'),
				dateStart: function () {
					return moment().subtract(1, 'months').startOf('month');
				},
				dateEnd: function () {
					return moment().subtract(1, 'months').endOf('month');
				}
			}, {
				text: _('Year to date'),
				dateStart: function () {
					return moment().startOf('year');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Since launch'),
				dateStart: function () {
					return moment(("2016-09-01"));
				},
				dateEnd: function () {
					return moment();
				}
			}],
			datepickerOptions: {
				firstDay: 1,
				dayNamesMin: [_('Su'), _('Mo'), _('Tu'), _('We'), _('Th'), _('Fr'), _('Sa')],
				monthNames: [_('January'), _('February'), _('March'), _('April'),
					_('May'), _('June'), _('July'), _('August'),
					_('September'), _('October'), _('November'), _('December')],
				numberOfMonths: 2,
				initialText: _('Select period...')
			},
			applyButtonText: _('Apply'),
			clearButtonText: _('Clear'),
			cancelButtonText: _('Cancel'),
			mirrorOnCollision: true
		});
		elem.daterangepicker("setRange", {
			start: stringToDate(jQuery('#startId').val()),
			end: stringToDate(jQuery('#endId').val())
		});
		elem.on('change', function () {
			var range = elem.daterangepicker("getRange");
			jQuery('#startId').val(dateToString(range.start));
			jQuery('#endId').val(dateToString(range.end));
			$.dispatchEvent($('startId'), 'change');
			$.dispatchEvent($('endId'), 'change');
		});
	});

	return div(
		dateFrom({
			id: 'startId',
			type: 'hidden'
		}),
		dateTo({
			id: 'endId',
			type: 'hidden'
		}),
		input({
			id: opts.id || 'rangepicker',
			rangepicker: ''
		})
	);
};
<commit_msg>#1823 proper week start in selector<commit_after>'use strict';
	/*
	To use rangepicker prepend following snippet to index.html.tpl
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/jquery.min.js"></sc' + 'ript>');
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/jquery-ui.min.js"></sc' + 'ript>');
	document
	.write('<scr' + 'ipt data-spa crossorigin defer src="/js/moment.min.js"></sc' + 'ript>');
	document
	.write('<scr' +
	'ipt data-spa crossorigin defer src="/js/jquery.comiseo.daterangepicker.js"></sc' + 'ript>');
	*/
var _ = require('mano').i18n.bind('Daterange')
  , dateFrom = require('./select-date-from')
  , dateTo = require('./select-date-to')
  , moment = window.moment
  , jQuery = window.jQuery;

module.exports = function (/* opts */) {
	var opts = Object(arguments[0]);

	var dateToString = function (date) {
		return moment(date).format('YYYY-MM-DD').toString();
	};

	var stringToDate = function (string) {
		return moment(string).toDate();
	};

	setTimeout(function () {
		if (!jQuery) {
			console.error('Probably you will have to integrate JQuery and all ' +
				'rangepicker dependencies into into index.html.tpl file. ' +
				'Check select-date-range.js for instructions.');
		}
		var elem = jQuery('[rangepicker]');
		elem.daterangepicker({
			presetRanges: [{
				text: _('Today'),
				dateStart: function () {
					return moment();
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Yesterday'),
				dateStart: function () {
					return moment().subtract('days', 1);
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Week to date'),
				dateStart: function () {
					// JS week starts on Sunday
					return moment().startOf('week').add(1, 'days');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Month to date'),
				dateStart: function () {
					return moment().startOf('month');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Last month'),
				dateStart: function () {
					return moment().subtract(1, 'months').startOf('month');
				},
				dateEnd: function () {
					return moment().subtract(1, 'months').endOf('month');
				}
			}, {
				text: _('Year to date'),
				dateStart: function () {
					return moment().startOf('year');
				},
				dateEnd: function () {
					return moment();
				}
			}, {
				text: _('Since launch'),
				dateStart: function () {
					return moment(("2016-09-01"));
				},
				dateEnd: function () {
					return moment();
				}
			}],
			datepickerOptions: {
				firstDay: 1,
				dayNamesMin: [_('Su'), _('Mo'), _('Tu'), _('We'), _('Th'), _('Fr'), _('Sa')],
				monthNames: [_('January'), _('February'), _('March'), _('April'),
					_('May'), _('June'), _('July'), _('August'),
					_('September'), _('October'), _('November'), _('December')],
				numberOfMonths: 2,
				initialText: _('Select period...')
			},
			applyButtonText: _('Apply'),
			clearButtonText: _('Clear'),
			cancelButtonText: _('Cancel'),
			mirrorOnCollision: true
		});
		elem.daterangepicker("setRange", {
			start: stringToDate(jQuery('#startId').val()),
			end: stringToDate(jQuery('#endId').val())
		});
		elem.on('change', function () {
			var range = elem.daterangepicker("getRange");
			jQuery('#startId').val(dateToString(range.start));
			jQuery('#endId').val(dateToString(range.end));
			$.dispatchEvent($('startId'), 'change');
			$.dispatchEvent($('endId'), 'change');
		});
	});

	return div(
		dateFrom({
			id: 'startId',
			type: 'hidden'
		}),
		dateTo({
			id: 'endId',
			type: 'hidden'
		}),
		input({
			id: opts.id || 'rangepicker',
			rangepicker: ''
		})
	);
};

{'fraction_non_alphanumeric': 0.20778688524590164, 'fraction_numerical': 0.005054644808743169, 'mean_word_length': 3.258871436881908, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3099862', 'n_tokens_mistral': 3011, 'n_tokens_neox': 2414, 'n_words': 507}