Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

Alias with datetime and long months is not working properly

Open stsrki opened this issue 2 years ago • 30 comments

I'm not sure if this is a bug or if I am missing something.

I have a simple mask with the following options.

picker.inputMask = new Inputmask({
    alias: "datetime",
    inputFormat: "dd.mmmm.yyyy"
});

picker.inputMask.mask(picker.altInput);

The input is rendered as following

image

For some reason, the year part is lost completely, and the month part is moved from the center to the far right. Notice the dots in the middle. Does anyone know what might be wrong here?

User version: 5.0.9-beta.35

stsrki avatar Oct 21 '23 11:10 stsrki

@stsrki ,

The problem is like image

Not yet implemented :)

RobinHerbots avatar Oct 27 '23 13:10 RobinHerbots

Any change it could be done in a timely manner?

Ps. Would you be interested in working on contractor basis for this, and any future requests?

stsrki avatar Oct 27 '23 13:10 stsrki

@stsrki,

Working on contract basis is not that simple as just saying yes, .... a donation can change priorities ;-)

Anyway, I did a first attempt for the implementation. Can you have a try. You need to take the file from the dist folder.

RobinHerbots avatar Oct 30 '23 19:10 RobinHerbots

a donation can change priorities ;-)

Will do :)


Anyways. There are still some issue.

  1. The long month with the format mmmm/dd/yyyy is fully broken. See an image. There are some extra tokens in the middle of the mask
  2. The short format, mmm/dd/yyyy works for all month names except for the dec. I cannot write it.

image

stsrki avatar Oct 31 '23 10:10 stsrki

#2394

RobinHerbots avatar Nov 07 '23 08:11 RobinHerbots

  1. Writing dec now works. But there is now a problem when we try to enter an invalid value. To reproduce just write jan and then 4.

image


  1. Regarding the long format, mmmm/dd/yyyy. It still shows the wrong mask.

image

stsrki avatar Nov 07 '23 16:11 stsrki

Also see #2277

RobinHerbots avatar Nov 16 '23 23:11 RobinHerbots

@stsrki , Can you have a try with v5.0.9-beta.45.

RobinHerbots avatar Nov 16 '23 23:11 RobinHerbots

I've tried v5.0.9-beta.45, but unfortunately, the same errors are still happening.

stsrki avatar Nov 17 '23 08:11 stsrki

Can you remove the placeholder property and try the long datetime mmmm/dd/yyyy

RobinHerbots avatar Nov 17 '23 09:11 RobinHerbots

I didn't tested the first issue yet. I will have a look at that too.

RobinHerbots avatar Nov 17 '23 09:11 RobinHerbots

Without the placeholder, it looks like this

image

stsrki avatar Nov 17 '23 09:11 stsrki

Are you sure you are using the latest version? Can you create a codepen or fiddle.

RobinHerbots avatar Nov 17 '23 09:11 RobinHerbots

Yes, I have downloaded the latest version. Also, I cleared the cache to make sure the latest files are being used.

Can you create a codepen or fiddle.

Give me some time to do so.

stsrki avatar Nov 17 '23 10:11 stsrki

Directly try with 5.0.9-beta.46, this fixes the first issue.

RobinHerbots avatar Nov 17 '23 11:11 RobinHerbots

Can confirm the first issue is now fixed 🎉

stsrki avatar Nov 17 '23 11:11 stsrki

Hello @RobinHerbots

Since this is the continuation of the same feature, I don't think there is a need to open a new issue.

Input masks now mostly work, except for the long formats. However, the main issue that we got reported by the users is that the edit mask is case-sensitive.

For example:

Works if you type in for 7th July 1967,

07 Jul 1967

or

7 Jul 1967

But not

07 JUL 1967

or 07 jul 1967

Seems the month name is case-sensitive.

it's hard to get the user to type Jul in the correct case (capital J, lowercase ul).


PS. the contractor offer is still open if you're willing to do so. Otherwise, donations are also OK but it gets complicated when paying with the company.

stsrki avatar Jan 05 '24 09:01 stsrki

@stsrki,

Strange, using inputFormat: dd mmm yyyy seems to accept Jul jul JUL even jUL JuL, ... UX wise this is not good, should I force it to lowercase? whatever you type?

For the long datetime format, I know exactly what is the problem, but I still need to find the time to figure, how to deal with that.

RobinHerbots avatar Jan 05 '24 21:01 RobinHerbots

Well, from the regular user perspective, they should not bother with writing the exact title-cased names. So making it case-insensitive would be the best way forward. To have it accept any value, Jul jul JUL, etc.

stsrki avatar Jan 06 '24 11:01 stsrki

Hi @stsrki ,

I did some fixes for the long date format.

Can you have a try with the latest beta.

Best regards, Robin

RobinHerbots avatar Mar 20 '24 19:03 RobinHerbots

Hello, sorry for not responding sooner. I was out of the town.

Anyway, I tried the new version, and I don't think it still works. Here are my observations. (Image for context)

image

image

  1. The long-date mask is still invalid. Notice the /ry/ in the mask
  2. After I type the month name, it changes to an invalid name. Februa0y
  3. For some reason, it now shows an input mask below the input. Is this for debugging purposes?
  4. There are a lot of console logs(see image)

image

stsrki avatar Mar 21 '24 19:03 stsrki

Grr, I forgot to remove the console .log ;-)

Ok I tested with dd mmmm yyyy, there it should work ok, when using mmmm dd yyyy indeed I see the problem.

RobinHerbots avatar Mar 21 '24 21:03 RobinHerbots

@stsrki ,

Tadaa, another attempt v5.0.9-beta.53

RobinHerbots avatar Mar 21 '24 21:03 RobinHerbots

Unfortunately, I still see the same problem 😅

The mask is mmmm/dd/yyyy.

image

stsrki avatar Mar 22 '24 09:03 stsrki

Can you have a try with this codepen.

https://codepen.io/robinherbots/pen/VwNbmNP

Btw when using the colormask.js, you also need to include the colormask.css (and it is still experimental, .... awaiting some feedback, from someone, ...)

RobinHerbots avatar Mar 22 '24 14:03 RobinHerbots

The codepen seems to work.

Btw when using the colormask.js, you also need to include the colormask.css (and it is still experimental, .... awaiting some feedback, from someone, ...)

Is this why the text shows bellow the input? I can review it, just let me know the details.

  • How to enabled/disable it?
  • Can I control the colors?
  • anything else I need to know?

stsrki avatar Mar 22 '24 19:03 stsrki

@stsrki , For the color mask we can best continue on #2310.

The codepen is working so I can conclude this issue is fixed?

RobinHerbots avatar Mar 23 '24 22:03 RobinHerbots

Maybe not just yet. While the codepen works it is really basic example so I went to see what is different from my code. With only inputFormat it works. But when I also assign the placeholder then it doesn't work.

Just use this on codepen and you will see it:

Inputmask("datetime", {
		inputFormat: "mmmm/dd/yyyy",
		placeholder: "mmmm/dd/yyyy",
	}).mask("input");

stsrki avatar Mar 24 '24 08:03 stsrki

Yes, true. To be able to handle the dynamic length in the long date format the placeholder is generated based on the inputformat, but this only happens when not providing a placeholder of your own. The best approach will be ignoring the provided placeholder in this case.

Or is there a case for a custom input placeholder in the datetime alias? I will currently ignore when using the long date format.

RobinHerbots avatar Mar 27 '24 08:03 RobinHerbots

In our project, developers can define the placeholders as they wish. So there is a need for it to work along with inputFormat.

stsrki avatar Mar 27 '24 08:03 stsrki