Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error while displaying date when language is changed from english to polish. #8190


User avatar
0
MellowoodMedical created

Hi,

I have a date field which will show correct value when in 'en' but if the language is changed to 'zh-Hans' or 'pl' and few more languages on the portal, it is showing 'invalid date' with the following error on browser console. I have also noticed for language 'danish' its showing 'Feb 19, 1984' instead of 'Feb 14, 1984' in english. This is an issue blocking us from going Live. Please let me know if you need any further details.

main.b0db31c71107ecc133f7.js:1 ERROR Error: InvalidPipeArgument: 'Unable to convert "Invalid Date" into a date' for pipe 'e'
    at $e (main.b0db31c71107ecc133f7.js:1)
    at e.transform (main.b0db31c71107ecc133f7.js:1)
    at main.b0db31c71107ecc133f7.js:1
    at main.b0db31c71107ecc133f7.js:1
    at Cm (main.b0db31c71107ecc133f7.js:1)
    at oz (main.b0db31c71107ecc133f7.js:1)
    at Object.updateDirectives (6.6b9e29a544a39c1d7d2e.js:1)
    at Object.updateDirectives (main.b0db31c71107ecc133f7.js:1)
    at Tm (main.b0db31c71107ecc133f7.js:1)
    at Im (main.b0db31c71107ecc133f7.js:1)

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Can this problem be reproduced in Zero's demo site?

  • User Avatar
    0
    MellowoodMedical created

    Hi ,

    The issue happens when we are trying to display a date on bootstrap date picker in the above languages and using a date pipe. On this demo site , I could not see any place where there is a datepicker displaying date.

    <input
                        type="text"
                        class="form-control"
                        placeholder="{{ l('DOB') }}"
                        autocomplete="off"
                        bsDatepicker
                        [ngModel]="demoDetails.dob | date"
                        [bsConfig]="{
                            adaptivePosition: true,
                            dateInputFormat: 'MMM D, YYYY'
                        }"
                        (bsValueChange)=
                        "demoDetails.dob = $event"
                        name="dob"
                        [ngClass]="{ 'is-invalid': myForm.hasError('required','dob')}" 
                        formControlName="dob"
                    />
    
  • User Avatar
    0
    MellowoodMedical created

    Hi ,

    Looks like the issue only exists for Bootstrap date picker while displaying a date field like above.

    when displaying the same date with pipe on a td element , displays the correct date. Let me know if you need any further information.

  • User Avatar
    0
    musa.demir created

    Hi @MellowoodMedical

    Can you please check if adding datePickerMomentModifier to your datepicker solves your problem.

    check that: demo-ui-date-time.component.html

    If your version of ASP.Net Zero does not contains datePickerMomentModifier you can add it manually. Check: date-picker-moment-modifier.directive.ts

  • User Avatar
    0
    MellowoodMedical created

    Hi ,

    I have implemented the datePickerMomentModifier but no luck. This to convert every date as moment but the actual issue here is when using date pipe with different locale like 'zh-Hans' or 'swedish' on bootstrap date picker.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @MellowoodMedical

    Have you solved this issue ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.