Skip to content
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

Implement an option to enable/disable date tags #1553

Open
tormozit opened this issue Sep 21, 2023 · 4 comments
Open

Implement an option to enable/disable date tags #1553

tormozit opened this issue Sep 21, 2023 · 4 comments

Comments

@tormozit
Copy link

tormozit commented Sep 21, 2023

  1. ОК
    {
    "test": 123456789012
    }
    изображение

  2. Not OK - extra date appeared
    {
    "test": 1234567890123
    }
    изображение

@josdejong
Copy link
Owner

The editor uses some heuristics to determine whether a value contains a unix timestamp, and in that case displays a tag showing the date. Similarly, it interprets when a values is a color and then shows a colorpicker.

If you don't want the date tag, you can hide it via CSS.

Do you actually have with real world data with numbers in this range?

@tormozit
Copy link
Author

I think many users will be happy to have an option to turn off the heuristics. I agree they are usefull but not all the time.
My case - user was confused by strange data in tree mode. And he created bug-ticket for me.

@josdejong josdejong changed the title Bug in number processing in tree mode Implement an option to enable/disable date tags Sep 21, 2023
@josdejong
Copy link
Owner

Makes sense to implement a configuration option for this. And we should probably create an option for the color picker too.

Anyone interested in implementing this option? Help would be welcome.

@tormozit
Copy link
Author

tormozit commented Sep 21, 2023

For my taste gray color is optimal for most cases. Current blue is too saturated.
editor.menu.style.backgroundColor = "#d0d0d0";

I turned off unwanted date heuristics here

 if (this._showTimestampTag()) {
          if (!this.dom.date) { 
          	return // FIX
            this.dom.date = document.createElement('div');
            this.dom.date.className = 'jsoneditor-date';
            this.dom.value.parentNode.appendChild(this.dom.date);
          }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants