-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[Bug]: Unpredictable movements of the dates in the date picker included in the table widget; are decreased by 1 day. #25081
Comments
My understanding here is that the timezone that is stored in the DB and selected on client side are different. |
This is not unpredictable this is always happening when:
The problem here is that I set my date widget to use format date format (and display format) YYYY-MM-DD. Apparently when updating the row I can see by printing with in logs that "currentRow" does correctly hold a date in the format YYYY-MM-DD that match the one you select in the widget. But when adding a row the value hold by "newRow" is in format 2023-07-19T22:00:00.000Z. So probably if you select 2023-07-20 in that widget it actually select 2023-07-20T00:00 in my local time zone and then transform it to UTC time zone. While it should work only with date (with no time) Well anyway the problem happens in the widget as I can see this happens before the query to the DB. Moreover the issue only happen with new row, row update seems to work. |
Looking at the code for DateCell widget I can see that when selecting the date while updating a date, the date is formated with Thus this probably lead to keeping the date with time when beeing in newRow mode and so applying some timezoning but correctly handinling the updates. See below the whole code block:
|
Is there a way I can contribute to this, any steps to reproduce |
Well check the 1st post it includes a link to a sample app that shows the issue. |
Thanks for the detailed analysis @benjamindonze. This will help us debug and triage the issue better. @amareshvarma LMK if you are interested in contributing. This issue might be involved, so my suggestion is to start with other |
@benjamindonze |
I have invited support@appsmith.com and made that app public so you should now have access otherwise I don't know how I can give you access |
@amareshvarma the app might not be accessible to you. You will have to repro this on your own end. |
Hello can you please use - @somangshu you are right, this confusion is coming quite often because selectedDate is taking the user's selection and internally using the locale to convert to UTC time. Our options are
Please suggest if there are other options. |
I can also add you to the app if you want |
@somangshu @keyurparalkar @dilippitchika I have been faced with this issue and was pointed here form the discord support channel I think I have since found a solution although it is early days I was finding that, no matter what I tried, when using I have since added the This seems to have sorted the issue but time will tell |
Any news on fixing this issue? |
@benjamindonze we haven't picked this up yet and this could be an issue with moment. Try using the solution that Paul has mentioned above and let us know if it works! |
I have picked up the issue and I have tried changing the timezone to europe and connected to datasource but I couldnt reproduce the issue ,are there any steps how to reproduce this or is it resolved ? |
Have you tried the public sample app link in the first post : https://app.appsmith.com/app/bug-date-simple/page1-64a7d393af033d5dcc48b2e6 It is very easy to see that the problem is still there. If you simply click "Add new row" and the select a date the save. Then you can see on the left pane "Changed row" that the date is not correct. You can also clearly see behavior is different when you change an existing row |
Thanks for the response @benjamindonze ,will look into that |
…in the table widget; are decreased by 1 day appsmithorg#25081
hello @benjamindonze I have raised a pr for this issue,can you please look into it |
I did put a comment and approved the PR |
…ix Timestamp (ms) (#36455) ## Description **Problem** When populating a table widget with data that includes dates in Unix timestamp (milliseconds) format, setting the column type to "Date," the input format to "Unix timestamp (ms)," and selecting a display format leads to an issue during inline editing. While the date picker behaves correctly, selecting a new date results in the table cell showing an "Invalid Date" error. **Root Cause** The platform currently uses DateInputFormat.MILLISECONDS for Unix timestamp (ms) formatting. However, this value is not a valid option for the moment.format() function, which expects the input format to be 'x' for Unix timestamps in milliseconds. This mismatch leads to the "Invalid Date" error. **Solution** Modify the logic to map DateInputFormat.MILLISECONDS to the correct moment format string 'x'. Adjust the table's transformDataPureFn to correctly process and display dates in Unix timestamp (ms) format after inline edits, ensuring the moment library can handle the input properly. **Outcome** This fix ensures that when a user selects a date via the date picker in inline editing mode, the selected date is displayed correctly in the table without any errors. Fixes #35631, #25081 ## Automation /ok-to-test tags="@tag.Sanity, @tag.Binding, @tag.Table, @tag.Datepicker" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11101758400> > Commit: 6a3cae7 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11101758400&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity, @tag.Binding, @tag.Table, @tag.Datepicker` > Spec: > <hr>Mon, 30 Sep 2024 08:54:58 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced date column editing in table widgets to accept Unix timestamps in milliseconds without errors. - Introduced a new enumeration for improved date formatting options. - Added mock data structures for testing various date formats and transformations in the table widget. - New method for generating formatted date strings for tomorrow in both verbose and ISO formats. - **Bug Fixes** - Improved validation logic for date inputs in the table, ensuring proper handling of different date formats. - **Tests** - Added new test cases to validate date handling and input formats in the table widget. - Introduced a new test suite for transforming table data based on specified column metadata. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This is fixed with: #36455 |
Is there an existing issue for this?
Description
Currently, in a table widget, if we try to add a new row and one of the fields is a date picker, it will decrease the selected date by one day. For example, if I select
2023-07-09
, it will select2023-07-08
. The strange thing about this bug is that it only occurs in a European time zone; it doesn't happen in another time zone.Steps To Reproduce
I tried to replicate the issue unsuccessfully. However, the user shared the application where the problem can be seen. Make sure you are in a European time zone.
For more context and videos, you can see the conversation with the user: https://app.frontapp.com/open/cnv_11b2uw5o?key=6Ow9FD3H6U0PYcJY6lBMKc7w2XqkaAaq
Public Sample App
https://app.appsmith.com/app/bug-date-simple/page1-64a7d393af033d5dcc48b2e6
Environment
Production
Issue video log
https://www.loom.com/share/405cc2a2c6aa416ea7245721dc33dc76?sid=398a0130-dc0e-4bea-8be4-44fc7b0c83e8
Version
Cloud: Appsmith v1.9.25-SNAPSHOT
The text was updated successfully, but these errors were encountered: