{
  "schemaVersion": 1,
  "slug": "screen-time-calculator",
  "category": "everyday",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "9e6ba5988f7841466b729116c7ec414fd7447d7fabda98111ff0641bb7ba2a7f",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/screen-time-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "T = Σh_i; L = T×(1 − w÷100); S = T÷W×100; Y = 365T÷24",
    "vars": [
      [
        "T",
        "Total daily screen time (h)"
      ],
      [
        "h_i",
        "Daily hours on each device"
      ],
      [
        "w",
        "Work/study share (%)"
      ],
      [
        "W",
        "Waking hours per day"
      ],
      [
        "L",
        "Leisure screen time (h/day)"
      ],
      [
        "S",
        "Screen time as share of waking hours (%)"
      ],
      [
        "Y",
        "Full days per year"
      ]
    ],
    "note": "Device hours are summed as entered; simultaneous use can be double-counted. Yearly days = daily hours × 365 ÷ 24; waking share uses the entered waking-hours value."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const totalDaily=phoneHours+computerHours+tvHours+tabletHours;const leisureDaily=totalDaily*(1-workRelatedPercent/100);const shareOfWaking=wakingHours>0?totalDaily/wakingHours*100:0;const yearlyHours=totalDaily*365;const yearlyDays=yearlyHours/24;return{totalDaily,leisureDaily,shareOfWaking,yearlyHours,yearlyDays};",
    "inputs": [
      {
        "name": "phoneHours",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 24,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "computerHours",
        "type": "number",
        "default": 6,
        "min": 0,
        "max": 24,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "tvHours",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 24,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "tabletHours",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 24,
        "step": 0.25,
        "slider": true
      },
      {
        "name": "workRelatedPercent",
        "type": "number",
        "default": 50,
        "min": 0,
        "max": 100,
        "step": 5,
        "slider": true
      },
      {
        "name": "wakingHours",
        "type": "number",
        "default": 17,
        "min": 8,
        "max": 22,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "totalDaily",
        "precision": 2,
        "unit": "h"
      },
      {
        "name": "leisureDaily",
        "precision": 2,
        "unit": "h"
      },
      {
        "name": "shareOfWaking",
        "precision": 1,
        "unit": "%"
      },
      {
        "name": "yearlyHours",
        "precision": 0,
        "unit": "h"
      },
      {
        "name": "yearlyDays",
        "precision": 1,
        "unit": "days"
      }
    ],
    "interpret": null
  }
}
