"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
var __webpack_exports__ = {};
const external_dayjs_namespaceObject = require("dayjs");
var external_dayjs_default = /*#__PURE__*/ __webpack_require__.n(external_dayjs_namespaceObject);
const external_vitest_namespaceObject = require("vitest");
const external_util_js_namespaceObject = require("../util.js");
describe('mapDatePicker', ()=>{
    it('showTime is true and gmt is true', ()=>{
        const props = {
            value: '2022-02-22T22:22:22.000Z',
            showTime: true,
            gmt: true
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        expect(result.value.format('YYYY-MM-DD HH:mm:ss')).toBe('2022-02-22 22:22:22');
    });
    it('showTime is true and gmt is false', ()=>{
        const props = {
            value: '2022-02-22T22:22:22.000Z',
            showTime: true,
            gmt: false
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        expect(result.value.format('YYYY-MM-DD HH:mm:ss')).toBe(external_dayjs_default()('2022-02-22T22:22:22.000Z').format('YYYY-MM-DD HH:mm:ss'));
    });
    it('showTime is false and gmt is true', ()=>{
        const props = {
            value: '2022-02-22T00:00:00.000Z',
            showTime: false,
            gmt: true
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        expect(result.value.format('YYYY-MM-DD HH:mm:ss')).toBe('2022-02-22 00:00:00');
    });
    it('showTime is false and gmt is false', ()=>{
        const props = {
            value: '2022-02-22',
            showTime: false,
            gmt: false
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        expect(result.value.format('YYYY-MM-DD HH:mm:ss')).toBe('2022-02-22 00:00:00');
    });
    it('should call onChange with correct value when showTime is true and gmt is true', ()=>{
        const props = {
            showTime: true,
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default().utc('2022-02-22 22:22:22'));
        expect(props.onChange).toHaveBeenCalledWith('2022-02-22T22:22:22.000Z');
    });
    it('should call onChange with correct value when showTime is true and gmt is false', ()=>{
        const props = {
            showTime: true,
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-22 22:22:22');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.toISOString());
    });
    it('should call onChange with correct value when showTime is false and gmt is true', ()=>{
        const props = {
            showTime: false,
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default().utc('2022-02-22'));
        expect(props.onChange).toHaveBeenCalledWith('2022-02-22T00:00:00.000Z');
    });
    it('should call onChange with correct value when showTime is false and gmt is false', ()=>{
        const props = {
            showTime: false,
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-22');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.toISOString());
    });
    it('should call onChange with correct value when picker is year and gmt is true', ()=>{
        const props = {
            picker: 'year',
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default().utc('2022-01-01T00:00:00.000Z'));
        expect(props.onChange).toHaveBeenCalledWith('2022-01-01T00:00:00.000Z');
    });
    it('should call onChange with correct value when picker is year and gmt is false', ()=>{
        const props = {
            picker: 'year',
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-01 00:00:00');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.startOf('year').toISOString());
    });
    it('should call onChange with correct value when picker is month and gmt is true', ()=>{
        const props = {
            picker: 'month',
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default().utc('2022-02-22T00:00:00.000Z'));
        expect(props.onChange).toHaveBeenCalledWith('2022-02-01T00:00:00.000Z');
    });
    it('should call onChange with correct value when picker is month and gmt is false', ()=>{
        const props = {
            picker: 'month',
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-01 00:00:00');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.startOf('month').toISOString());
    });
    it('should call onChange with correct value when picker is quarter and gmt is true', ()=>{
        const props = {
            picker: 'quarter',
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default().utc('2022-02-22T00:00:00.000Z'));
        expect(props.onChange).toHaveBeenCalledWith('2022-01-01T00:00:00.000Z');
    });
    it('should call onChange with correct value when picker is quarter and gmt is false', ()=>{
        const props = {
            picker: 'quarter',
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-01 00:00:00');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.startOf('quarter').toISOString());
    });
    it('should call onChange with correct value when picker is week and gmt is true', ()=>{
        const props = {
            picker: 'week',
            gmt: true,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default().utc('2022-02-21T00:00:00.000Z');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.startOf('week').add(1, 'day').toISOString());
    });
    it('should call onChange with correct value when picker is week and gmt is false', ()=>{
        const props = {
            picker: 'week',
            gmt: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        const m = external_dayjs_default()('2022-02-21 00:00:00');
        result.onChange(m);
        expect(props.onChange).toHaveBeenCalledWith(m.startOf('week').add(1, 'day').toISOString());
    });
    it('should call onChange with correct value when utc is false', ()=>{
        const props = {
            showTime: true,
            gmt: true,
            utc: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default()('2022-02-22 22:22:22'));
        expect(props.onChange).toHaveBeenCalledWith('2022-02-22 22:22:22');
    });
    it('should call onChange with correct value when picker is year and utc is false', ()=>{
        const props = {
            showTime: false,
            gmt: true,
            utc: false,
            onChange: external_vitest_namespaceObject.vi.fn()
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        result.onChange(external_dayjs_default()('2022-01-01 23:00:00'));
        expect(props.onChange).toHaveBeenCalledWith('2022-01-01');
    });
    it('utc is false and gmt is true', ()=>{
        const props = {
            value: '2022-01-01 23:00:00',
            showTime: true,
            gmt: true,
            utc: false
        };
        const result = (0, external_util_js_namespaceObject.mapDatePicker)()(props);
        expect(result.value.format('YYYY-MM-DD HH:mm:ss')).toBe('2022-01-01 23:00:00');
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
