Clay: [Date Picker] Hyphen vs Slash

Created on 10 Mar 2021  Â·  4Comments  Â·  Source: liferay/clay

I'm working on a new variant for the date picker component to allow users to select a date range (see LEXI-1127) and I noticed Clay is using hyphens by default in the format of the date.

In the new variant I was planning to use the following format using slashes and a dash: "YYYY/MM/DD – YYYY/MM/DD".

date range

I read that this is defined by the formatting rules of date-fns which is an implementation of the unicode technical standards.

I have four questions:

  1. Are the hyphens "-" used in the format date related to the internationalization feature?
  2. Could we set by default to use "/" instead of "-"?
  3. Do we have a forgiving format feature?
  4. Do you have any technical recommendations for the new variant I'm working on?

Thanks!

question

Most helpful comment

Hey @drakonux, answering some of your questions:

Are the hyphens "-" used in the format date related to the internationalization feature?

I think this is related to internationalization, some languages seem to use "-" instead of "/".

Could we set by default to use "/" instead of "-"?

I do not see any problems in defining to use this standard, it is worth remembering that Clay is not opinionated in this part, it allows an API that teams can change the date format according to the internationalization mechanism...

Do we have a forgiving format feature?

Well, as I said above, Clay provides the APIs needed to format the date and deal with internationalization but does not automatically detect the user's language, this is up to those who are using Clay to implement their own mechanism.

Do you have any technical recommendations for the new variant I'm working on?

These are some of the questions that come to my mind right now, maybe I can come up with more when we have the document with the details.

  • I believe that the user will also be able to write in the right input? maybe it's time to implement a masking mechanism to make typing easier and not break with the parse system.
  • Will the date range have any limits? I can have a range of years, months...
  • Will the Data Range allow extension points, such as adding the timer?

All 4 comments

Hey @drakonux, answering some of your questions:

Are the hyphens "-" used in the format date related to the internationalization feature?

I think this is related to internationalization, some languages seem to use "-" instead of "/".

Could we set by default to use "/" instead of "-"?

I do not see any problems in defining to use this standard, it is worth remembering that Clay is not opinionated in this part, it allows an API that teams can change the date format according to the internationalization mechanism...

Do we have a forgiving format feature?

Well, as I said above, Clay provides the APIs needed to format the date and deal with internationalization but does not automatically detect the user's language, this is up to those who are using Clay to implement their own mechanism.

Do you have any technical recommendations for the new variant I'm working on?

These are some of the questions that come to my mind right now, maybe I can come up with more when we have the document with the details.

  • I believe that the user will also be able to write in the right input? maybe it's time to implement a masking mechanism to make typing easier and not break with the parse system.
  • Will the date range have any limits? I can have a range of years, months...
  • Will the Data Range allow extension points, such as adding the timer?

Thanks Matu!

I think this is related to internationalization, some languages seem to use "-" instead of "/".

👌

I do not see any problems in defining to use this standard, it is worth remembering that Clay is not opinionated in this part, it allows an API that teams can change the date format according to the internationalization mechanism...

👌 We are using "/" instead of "-" in our documentation but it's ok. We plan to update it on LEXI-975. We will give a recommendation of use.

About forgiving format :

Well, as I said above, Clay provides the APIs needed to format the date and deal with internationalization but does not automatically detect the user's language, this is up to those who are using Clay to implement their own mechanism.

I believe that the user will also be able to write in the right input? maybe it's time to implement a masking mechanism to make typing easier and not break with the parse system.

I think both are related. I was trying to find out if we do something to help the user typing the date. We will request improvements in that line with LEXI-975

Will the date range have any limits? I can have a range of years, months...

You are right. I've added that requirement to the definition doc. I think the component should provide two properties:

  • Min number of days between the start and end date.
  • Max number of days between the start and end date.

Will the Data Range allow extension points, such as adding the timer?

Currently, I don't have any requests to require it. However, I'm going to request a new side extension point.

Please find the request we made to create the new variant/feature on #3986

Thanks @drakonux!

Hey @drakonux I will go ahead and close this ticket I think the main question has been answered, if you have any further questions feel free to open an issue or reopen this. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dgarciasarai picture dgarciasarai  Â·  3Comments

hold-shift picture hold-shift  Â·  3Comments

bryceosterhaus picture bryceosterhaus  Â·  4Comments

bicienzu picture bicienzu  Â·  3Comments

kresimir-coko picture kresimir-coko  Â·  3Comments