<commit_before>/* eslint-disable no-console */
/* eslint-disable max-len */
/* eslint-disable no-underscore-dangle */
/* eslint-disable func-names */

import core from '@spiral-toolkit/core';
// import moment from 'moment';
import flatpickr from 'flatpickr';

export const DateInput = function (sf, node, options) {
  this._construct(sf, node, options);
};

/**
 * @lends sf.Form.prototype
 */
DateInput.prototype = Object.create(core.core.BaseDOMConstructor.prototype);

/**
 * Name to register
 * @type {string}
 */
DateInput.prototype.name = 'date';

DateInput.prototype._construct = function (sf, node, options) {
  this.init(sf, node, options);
  this.input = node.querySelector('input');
  this.picker = flatpickr(this.input, {
    enableTime: !!this.options.enableTime,
    noCalendar: !!this.options.noCalendar,
    altInput: true,
    altFormat: this.options.displayFormat || 'Y-m-d',
    dateFormat: this.options.dateFormat || 'Y-m-d',
    onChange: () => {

    },
  });
  console.log(this.options);
};

/**
 * @override
 * @inheritDoc
 * @enum {string}
 */
DateInput.prototype.optionsToGrab = {
  enableTime: {
    value: false,
    domAttr: 'data-enable-time',
  },
  noCalendar: {
    value: false,
    domAttr: 'data-no-calendar',
  },
  dateFormat: {
    value: 'Y-m-d',
    domAttr: 'data-format',
  },
  displayFormat: {
    value: 'Y-m-d',
    domAttr: 'data-display-format',
  },
};


DateInput.prototype.die = function () {
  delete this;
};

export { DateInput as default };<commit_msg>use ISO dates<commit_after>/* eslint-disable no-console */
/* eslint-disable max-len */
/* eslint-disable no-underscore-dangle */
/* eslint-disable func-names */

import core from '@spiral-toolkit/core';
// import moment from 'moment';
import flatpickr from 'flatpickr';

export const DateInput = function (sf, node, options) {
  this._construct(sf, node, options);
};

/**
 * @lends sf.Form.prototype
 */
DateInput.prototype = Object.create(core.core.BaseDOMConstructor.prototype);

/**
 * Name to register
 * @type {string}
 */
DateInput.prototype.name = 'date';

DateInput.prototype._construct = function (sf, node, options) {
  this.init(sf, node, options);
  this.input = node.querySelector('input');
  this.picker = flatpickr(this.input, {
    enableTime: !!this.options.enableTime,
    noCalendar: !!this.options.noCalendar,
    altInput: true,
    altFormat: this.options.displayFormat || 'Y-m-d',
    dateFormat: this.options.dateFormat || 'Z',
    onChange: () => {

    },
  });
  console.log(this.options);
};

/**
 * @override
 * @inheritDoc
 * @enum {string}
 */
DateInput.prototype.optionsToGrab = {
  enableTime: {
    value: false,
    domAttr: 'data-enable-time',
  },
  noCalendar: {
    value: false,
    domAttr: 'data-no-calendar',
  },
  dateFormat: {
    value: 'Z',
    domAttr: 'data-format',
  },
  displayFormat: {
    value: 'Y-m-d',
    domAttr: 'data-display-format',
  },
};


DateInput.prototype.die = function () {
  delete this;
};

export { DateInput as default };
{'fraction_non_alphanumeric': 0.16888297872340424, 'fraction_numerical': 0.0, 'mean_word_length': 3.471025260029718, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6598418', 'n_tokens_mistral': 1019, 'n_tokens_neox': 1016, 'n_words': 204}