Is it possible to remove or hide the time options from the date picker?

  • What Grafana version and what operating system are you using?
    Grafana Version: 11.0.0
    O/S: Ubuntu or MacOS

  • What are you trying to achieve?
    I’m trying to remove/disable time options from the date/time picker (i.e. last 7 days)

  • How are you trying to achieve it?
    I tried updating the json model, by adding an empty time_options array.

  • What happened?
    Time picker options were not removed.

  • What did you expect to happen?
    Time picker options were removed.

  • Can you copy/paste the configuration(s) that you are having problems with?
    “timepicker”: {
    “hidden”: false,
    “time_options”: [
    “30d”
    ],
    “type”: “timepicker”
    }

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors.

  • Did you follow any online instructions? If so, what is the URL?
    N/A

It is possible to modify XXXX.yyyyyyyyyyyyyyyyyyyy.js file in public/build folder that contains this list (for example, 4570.87a4acc6d9144f9ee50a.js for Grafana 11.0.0).

Search for the following text and remove periods that you don’t need.

const t=[{from:"now-5m",to:"now",display:"Last 5 minutes"},{from:"now-15m",to:"now",display:"Last 15 minutes"},{from:"now-30m",to:"now",display:"Last 30 minutes"},{from:"now-1h",to:"now",display:"Last 1 hour"},{from:"now-3h",to:"now",display:"Last 3 hours"},{from:"now-6h",to:"now",display:"Last 6 hours"},{from:"now-12h",to:"now",display:"Last 12 hours"},{from:"now-24h",to:"now",display:"Last 24 hours"},{from:"now-2d",to:"now",display:"Last 2 days"}...

Or modify source code and compile custom Grafana version

1 Like