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

Invalid date when timeOnly defined on datetime UIComponent #23157

Closed
duckchip opened this issue Jun 6, 2019 · 13 comments · Fixed by #31549
Closed

Invalid date when timeOnly defined on datetime UIComponent #23157

duckchip opened this issue Jun 6, 2019 · 13 comments · Fixed by #31549
Assignees
Labels
Component: Admin Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@duckchip
Copy link
Contributor

duckchip commented Jun 6, 2019

Preconditions (*)

  1. Magento 2.3.1

Steps to reproduce (*)

  1. Define a ui_component form.xml
  2. add a Datetime UI component with the option 'timeOnly' set to 'yes'
<field name="start_time"]
    [argument name="data" xsi:type="array"]
        [item name="config" xsi:type="array"]
            [item name="dataType" xsi:type="string"]string[/item]
            [item name="label" xsi:type="string" translate="true"]Start Time[/item]
            [item name="formElement" xsi:type="string"]date[/item]
            [item name="source" xsi:type="string"]import_profile[/item]
            [item name="dataScope" xsi:type="string"]start_time[/item]
            [item name="options" xsi:type="array"]
                [item name="timeOnlyTitle" xsi:type="string"]Select Start Time[/item]
                [item name="showsTime" xsi:type="boolean"]true[/item]
                [item name="timeOnly" xsi:type="boolean"]true[/item]
                [item name="timeFormat" xsi:type="string"]HH:mm:ss[/item]
                [item name="dateFormat" xsi:type="string"]yyyy-MM-dd[/item]
            [/item]
        [/item]
    [/argument]
[/field>
{code}
1. Save the form and check the result. 

### Expected result (*)
1. Correct time value

### Actual result (*)
1. The value states: 'Invalid Date'

### Additional information
This problem doesn't occur when the option 'timeOnly' is not defined. 

My best guess is that the problem happens inside the /module-ui/view/base/web/js/form/element/date.js at 'onShiftedValueChange' function..

{code}
 /**
        * Prepares and sets date/time value that will be sent
        * to the server.
        * * @param {String} shiftedValue
         */
        onShiftedValueChange: function (shiftedValue) {
            var value,
                formattedValue,
                momentValue;

            if (shiftedValue) {
                momentValue = moment(shiftedValue, this.pickerDateTimeFormat);

                if (this.options.showsTime) {
                    formattedValue = moment(momentValue).format(this.timezoneFormat);
                    //formattedValue returns an incorrect value. 
                    value = moment.tz(formattedValue, this.storeTimeZone).tz('UTC').toISOString();
                } else {
                    value = momentValue.format(this.outputDateFormat);
                }
            } else {
                value = '';
            }

            if (value !== this.value()) {
                this.value(value);
            }
        },
@m2-assistant
Copy link

m2-assistant bot commented Jun 6, 2019

Hi @duckchip. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@duckchip do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jun 6, 2019
@shikhamis11 shikhamis11 self-assigned this Jun 6, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jun 6, 2019

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@shikhamis11 shikhamis11 added Component: Admin Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jun 6, 2019
@ghost ghost unassigned shikhamis11 Jun 6, 2019
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jun 6, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @shikhamis11
Thank you for verifying the issue. Based on the provided information internal tickets MC-17293, MC-17294 were created

Issue Available: @shikhamis11, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@konarshankar07
Copy link
Contributor

@duckchip
Can you please give more information like which type of column did you created in the table?

Thanks

@duckchip
Copy link
Contributor Author

@konarshankar07 This is not on the table/listing but on the form UI component.

@konarshankar07
Copy link
Contributor

@duckchip Can you please add a screenshot of the error message?

@duckchip
Copy link
Contributor Author

Screen Shot 2019-06-11 at 13 29 25

In the console log you see 'Invalid date'

@konarshankar07
Copy link
Contributor

@duckchip Thanks for the screenshot. Yes, I'm also getting the same and I'll try to fix this and update you asap
image

@niravkrish niravkrish self-assigned this Jun 13, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jun 13, 2019

Hi @niravkrish. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.


@dankhrapiyush
Copy link
Contributor

I'm getting the same issue on the Magento 2.2.9.

@ghost ghost unassigned niravkrish Sep 27, 2019
@duckchip duckchip self-assigned this Oct 21, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 21, 2019

Hi @duckchip. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@duckchip duckchip removed their assignment Oct 21, 2019
@mahsn mahsn self-assigned this Nov 14, 2019
@m2-assistant
Copy link

m2-assistant bot commented Nov 14, 2019

Hi @mahsn. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@mahsn
Copy link

mahsn commented Nov 14, 2019

@magento I'm working on this issue

@sidolov sidolov added this to Ready for Development in Low Priority Backlog Sep 24, 2020
@ghost ghost removed this from Ready for Dev in Community Backlog Oct 20, 2020
@ghost ghost removed this from Ready for Development in Low Priority Backlog Oct 20, 2020
@ghost ghost removed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 20, 2020
@sdzhepa sdzhepa added Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it and removed Progress: ready for dev labels Oct 29, 2020
@gabrieldagama gabrieldagama added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Nov 3, 2020
@ghost ghost added this to Ready for Development in High Priority Backlog Nov 3, 2020
@ghost ghost removed this from Confirmed in Issue Confirmation and Triage Board Nov 3, 2020
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Jan 4, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Jan 5, 2021
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Development

Successfully merging a pull request may close this issue.

10 participants