Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AbpDatePicker #18648

Merged
merged 2 commits into from Jan 2, 2024
Merged

Improve AbpDatePicker #18648

merged 2 commits into from Jan 2, 2024

Conversation

salihozkara
Copy link
Member

@salihozkara salihozkara commented Dec 31, 2023

Description

Resolves #18335
Related #18298

Checklist

  • I fully tested it as developer
  • I documented it (or no need to document or I will create a separate documentation issue)

How to test it?

<abp-date-picker asp-for="SingleDate"></abp-date-picker>
$('#SingleDate').change(async function (e) {
        console.log("SingleDate change");
        var date = $(this).val();
        var date2 = $(this).data('date');
        var date3 = $(this).data('daterangepicker').startDate;

        console.log("val: ", date);
        console.log("data-date: ", date2);
        console.log("data-daterangepicker-startdate: ", date3);

        // change date
        $(this).val('2019-01-01');
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(moment('2019-01-02'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(new Date('2019-01-03'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(luxon.DateTime.fromFormat('2019-01-04', 'yyyy-MM-dd'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).data('daterangepicker').setStartDate('2019-01-05'); // doesn't work
        
        // infinite loop
        $(this).trigger('change');
    });
Untitled_.Dec.31.2023.6_03.PM.webm
$('#SingleDate').on('apply.daterangepicker', async function (ev, picker) {
        console.log("SingleDate apply.daterangepicker");
        var date = $(this).val();
        var date2 = $(this).data('date');
        var date3 = $(this).data('daterangepicker').startDate;
        var date4 = picker.startDate;

        console.log(date);
        console.log(date2);
        console.log(date3);
        console.log(date4);

        // change date
        $(this).val('2019-01-01');
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(moment('2019-01-02'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(new Date('2019-01-03'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).val(luxon.DateTime.fromFormat('2019-01-04', 'yyyy-MM-dd'));
        await new Promise(r => setTimeout(r, 2000));
        $(this).data('daterangepicker').setStartDate('2019-01-05'); // doesn't work
        await new Promise(r => setTimeout(r, 2000));
        picker.setStartDate('2019-01-06'); // doesn't work
        
        // infinite loop
        $(this).trigger('apply.daterangepicker', picker);
    });
Untitled_.Dec.31.2023.6_06.PM.webm

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (92b2c69) 51.72% compared to head (2f3b658) 51.74%.
Report is 152 commits behind head on dev.

Files Patch % Lines
...red/Bundling/SharedThemeGlobalScriptContributor.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #18648      +/-   ##
==========================================
+ Coverage   51.72%   51.74%   +0.02%     
==========================================
  Files        3075     3077       +2     
  Lines       96952    97066     +114     
  Branches     7720     7729       +9     
==========================================
+ Hits        50146    50227      +81     
- Misses      45271    45301      +30     
- Partials     1535     1538       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maliming maliming merged commit ea7200f into dev Jan 2, 2024
4 of 5 checks passed
@maliming maliming deleted the issue-18335 branch January 2, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

datepicker change event not working
2 participants