sartography / spiff-arena

SpiffWorkflow is a software development platform for building, running, and monitoring executable diagrams
https://www.spiffworkflow.org/
GNU Lesser General Public License v2.1
48 stars 36 forks source link

Update system date format for month name abbreviation #637

Closed harmeet-status closed 3 weeks ago

harmeet-status commented 6 months ago

Switch to the Verbose date format, 21-Oct-2023, when displaying system dates

In markdown instructions, you can now do:

SPIFF_FORMAT:::convert_seconds_to_date_time_for_display(1698677185)

This will display, when rendered on dev.app:

30-10-2023 10:46:25

Once we change the default date format in the dev.app configuration, it will instead display:

30-Oct-2023 10:46:25

I updated https://dev.app.spiff.status.im/process-models/site-administration:grocery to display a date when run.

note that seconds for the current time can be generated in python like: time.time()

calexh-sar commented 5 months ago

Once this issue is complete, #698 will be ready to start.

jasquat commented 5 months ago

Implemented with #835

dinithihj commented 4 months ago

@jasquat If I understand correctly, once we add SPIFFWORKFLOW_FRONTEND_RUNTIME_CONFIG_DATE_FORMAT to the config, system dates should be displayed according to the specified date format.

I'm not sure what value should be added there. I tried below but it's not seem to be working. image

Please let me know whether I should do something else to test this,

jasquat commented 4 months ago

@dinithihj it's date only. no time. And this is a config that must be set server side. I can put in a PR for the update.

jasquat commented 4 months ago

@dinithihj to test this, we will put the code with the "dd-MMM-yyyy" format on sartography and this can be tested there.

After the next release to status-im prod we can change the config.

dinithihj commented 4 months ago

@jasquat On sartography environment, When I select a date from the date picker it's giving me an error - Preferred Delivery Date must match format "date" image

Process model - https://sartography.spiffworkflow.org/process-models/misc:qa:check-date-format

jasquat commented 4 months ago

@dinithihj I removed "format": "date" from the jsonschema and now it works. Since the component itself forces the date format the explicit setting of format may not be necessary. Since we do not control that check this may be the best we can do.

@burnettk thoughs?

burnettk commented 4 months ago

we put in a fix for this. we want to make sure that the task data has dates in this format: 2024-12-25.

dinithihj commented 4 months ago

On sartography environment now the date is displayed in yyyy-mm-dd format.

image image image

jasquat commented 4 months ago

Forgot to commit the change to the configs. Updated again and should be good now.

dinithihj commented 4 months ago

On Sartography environment date format is displayed as dd-mmm-yyyy on date pickers and process instance view. image image

However, on task data, it's displaying in yyyy-mm-dd format. And when I printed the date value that also had the yyyy-mm-dd format. image

harmeet-status commented 4 months ago

@burnettk I'm assuming the format in task data needs to stay and we just worry about UI display format?

I think we definitely need to have the date pickers show the date in the correct format @dinithihj

jasquat commented 4 months ago

Yes @harmeet-status @dinithihj, we put dates into task data as yyyy-mm-dd so the system can have a consistent date format to deal with. The custom date formats should be for display only.

calexh-sar commented 2 months ago

@dinithihj and @jasquat I was checking on the status of this ticket in regards to whether I could start on #698 and noticed that the SPIFFWORKFLOW_FRONTEND_RUNTIME_CONFIG_DATE_FORMAT entry was no longer specified in the Configuration/Secrets. Am I correct in assuming this was not replaced the last time dev was dumped and perhaps it needs to be included in the Bootstrap process?

Is there more work needed on this issue or is it safe for me to start on #698 once the Configuration/Secrets is updated?

dinithihj commented 2 months ago

@calexh-sar I have tested this on Sartography environment and I don't think we have merged these changes to the dev.app. Also I believe this config is something that needs to be configured on the server side.

@jasquat @burnettk Please correct me if I'm wrong ^^

burnettk commented 2 months ago

Yeah, it’s a Jakub infra change: https://github.com/status-im/infra-spiff-workflow/pull/42. We’ll see what he says.

madhurrya commented 2 months ago

@harmeet-status are we going to update the Instructions also to match the same date format?

Image

Image

burnettk commented 2 months ago

it looks like we have a way to convert seconds to a correctly formatted datetime (see https://dev.app.spiff.status.im/process-models/misc:test:dinithi-testing:sartography-issues:559-formatting-in-extension-md), but maybe not a way to convert what i assume is originally "2027-12-31" in the task data to "31 Dec 2027". Though this date formatter without the time thing would be implementable.

calexh-sar commented 2 months ago

@madhurrya regarding your question to Harmeet about updating the instructions, that is the intent of issue #698.

burnettk commented 2 months ago

we have since filled the gap with converting "2027-12-31" to "31 Dec 2027"

madhurrya commented 2 months ago

Thanks Alex. I missed that ticket. :-)

madhurrya commented 2 months ago

Now we can see the new date format in the system in dev.app and test.app

sashayar13 commented 2 months ago

@burnettk @jasquat @harmeet-status The change also impacted the Date widgets used in process models (Preferred Delivery Date, Start date, etc.). Now the field requires a user to enter a date either in the exact format or to select it from a calendar.

For example, if a user types 01/04/2024 or 01.04.2024 or 01-apr-2024, the system replaces it with "01-Dec-2024". From a user experience perspective, the field should accept all mentioned inputs and transform them into the "01-Apr-2024".

jasquat commented 2 months ago

@sashayar13 #1319 should address most of your concerns. We're attempting to try and interpret what the user is trying to input.

@madhurrya @dinithihj it's out on dev now and ready to test.

dinithihj commented 2 months ago

Tested on dev.app (version 369/370) using the model https://dev.app.spiff.status.im/process-models/misc:qa:check-date with different date formats

If I type dates in the formats below, now it's correctly converting them to dd-mmm-yyyy.

If I type the date in the formats below, it WILL NOT be recognized and converted to dd-mmm-yyyy.

Sometimes, when I try to erase the date I entered and enter it again, it doesn't convert correctly. Video Link : https://drive.google.com/file/d/1QV_ydeXu1BoRgJP49SWFBEcERV2r_VGk/view?usp=sharing

Suggestion - If the system can't change the date the user entered to the dd-mmm-yyyy format, I think it's better to leave the date picker value blank instead of filling in an incorrect date. Then the user can return later and enter the correct value. For instance, if I enter 05/30/2020 and then move away from the control, it changes to 05-Dec-2019, which is completely wrong.

jasquat commented 1 month ago

We cannot support both mm-dd and dd-mm formats at the same time so that makes sense. We don't really support delimiters other than hyphens but we could add some support for periods and slashes but I suggest a new ticket for that if it's desired and keep it out of this ticket since it would be a new feature request. It works in some cases because of the converters we use but we'd need greater effort to make it work in more cases.

I'm not sure what we can do about not displaying any date if it's unrecognized. Unless we check for digits greater than 12 there's really nothing we can do since we don't know what the user's intent is.

I'm not sure what is going on in the video. I will play around a little bit to understand. I think you have to click outside the text field at some point though so it recognizes that something has changed but I'm not sure.

dinithihj commented 1 month ago

@sashayar13 Could you please check the list of formats that are supported and not supported? If there are any other formats you need support for, please let us know.

sashayar13 commented 1 month ago

If I type

Image

The system converts it to

Image

So I think it will be good if we add "DDMMYYYY" format too

jasquat commented 1 month ago

@sashayar13 I think any additional date formats should be in a new ticket. This ticket was about month abbreviations in the format and any other formats would have to be estimated and planned separately to figure what we can we cannot support.

sashayar13 commented 1 month ago

added the ticket https://github.com/sartography/spiff-arena/issues/1420

dinithihj commented 1 month ago

Moving this ticket to Ready for Release.

madhurrya commented 3 weeks ago

Released to Prod