question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Too eager date formatting

See original GitHub issue

Env: macOS / Chrome73.0.3683.86

When I try to change only year for some dates, formatting is “too eager”. Is there any way to disable such behaviour?

Demo:

Kapture 2019-03-25 at 14 20 10

Reproduction

For such date

2019-01-31

When I remove 9

This is the number that will be removed
   |
   |
   |
2019-01-31

I expect numbers below in the input

201-01-31

but I have

2010-12-1

I understand that probably some conversion/date formatting happen like below

201-01-31
2010-13-1 // is trying to format such date but there is no 13th month
2010-12-1 // so it ends up with 2010-12-1

Is there any way to disable that conversion?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:8

github_iconTop GitHub Comments

1reaction
dcorbcommented, May 8, 2019

Thanks @ahahn95 Finally I didn’t apply the Cleave date formatter, only the generic “blocks” options. The way I render the field, using dayjs, makes the date correct. The update happens via onBlur using hook setState. For now is enough good for the customer, but I will try text-mask in the future, looks good

value={dayjs(startValue).format("DD.MM.YYYY")}
 options={{
                    delimiter: ".",
                    blocks: [2, 2, 4],
                    numericOnly: true
                  }}
0reactions
markduncanawpcommented, Feb 3, 2021

Same issue, resolved by using the custom options. The user can key in any values they want which is fine for us, we’re using another library to validate the date.

var cleave = new Cleave(‘.input-element’, { delimiter: ‘/’, blocks: [2, 2, 2], });

Anyway, Great piece of work cleave.js!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I read the expiration date?... - Melody Meador Malone
I found this fb page trying to decifer the date AGAIN only to see I was here once already in the past. Your...
Read more >
32 First Date Red Flags - First Date Warning Signs
We spoke with 17 experts who revealed 30 red flags that you should look out for on a first date (and that you...
Read more >
Yahoo Dating Format And How Do You Recognize It
This are very important question to me and to any relationship before going into it. I want you know if you do believe...
Read more >
Dating: Over-Eagerness & Over-Thinking - YouTube
... an email from a viewer who is too over- eager to set the next date ... Paperback $49.99, Hardcover $99.99 and Audio...
Read more >
How do I format a Microsoft JSON date? - Stack Overflow
1) Detect Microsoft Date format // Handling of Microsoft AJAX Dates, formatted like '/Date(01238329348239)/' function looksLikeMSDate(s) { return /^\/Date\(/.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found