{
  "schemaVersion": 1,
  "slug": "time-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "8e06c2a9b1ab38b4817c1fe44356e55a3da419c4f3a3639fb83532435aaf95db",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/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": "R = V × F[from] ÷ F[to]; s = V × F[from]",
    "vars": [
      [
        "V",
        "Value"
      ],
      [
        "from",
        "Source unit"
      ],
      [
        "to",
        "Target unit"
      ],
      [
        "F",
        "Factor in seconds"
      ]
    ],
    "note": "F (seconds): ms 0.001, s 1, min 60, h 3600, d 86400, wk 604800, mo 2629800, yr 31557600; month and year use average lengths."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "NIST SP 811 — Conversion factors by quantity",
        "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9"
      }
    ],
    "basis": "Convert fixed time intervals via seconds.",
    "limitations": "Months and years, where offered, are fixed-duration conventions rather than calendar arithmetic.",
    "implementationHash": "8e06c2a9b1ab38b4817c1fe44356e55a3da419c4f3a3639fb83532435aaf95db",
    "domain": "conversion"
  },
  "contract": {
    "compute": "const units={\"ms\":\"ms\",\"s\":\"s\",\"min\":\"min\",\"h\":\"h\",\"d\":\"d\",\"wk\":\"wk\",\"mo\":\"mo\",\"yr\":\"yr\"}, factors={\"ms\":0.001,\"s\":1,\"min\":60,\"h\":3600,\"d\":86400,\"wk\":604800,\"mo\":2629800,\"yr\":31557600}; if(!Number.isFinite(value)||value<-1000000000000||value>1000000000000||!Object.prototype.hasOwnProperty.call(units,from)||!Object.prototype.hasOwnProperty.call(units,to))return {\"result\":null,\"seconds\":null,\"hours\":null,\"days\":null,\"__error\":\"inputError\"}; const out=(function(){const F={ms:0.001,s:1,min:60,h:3600,d:86400,wk:604800,mo:2629800,yr:31557600}; const s=value*F[from]; return { result: s/F[to], seconds: s, hours: s/3600, days: s/86400 };})(); if(out.__error)return {...{\"result\":null,\"seconds\":null,\"hours\":null,\"days\":null},...out}; out.__resultUnit=units[to]; out.__unitRatio=factors[to]/factors[from]; return out;",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 1,
        "min": -1000000000000,
        "max": 1000000000000,
        "step": 0.01,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "from",
        "type": "select",
        "default": "h",
        "options": [
          {
            "value": "h"
          },
          {
            "value": "ms"
          },
          {
            "value": "s"
          },
          {
            "value": "min"
          },
          {
            "value": "d"
          },
          {
            "value": "wk"
          },
          {
            "value": "mo"
          },
          {
            "value": "yr"
          }
        ]
      },
      {
        "name": "to",
        "type": "select",
        "default": "min",
        "options": [
          {
            "value": "min"
          },
          {
            "value": "ms"
          },
          {
            "value": "s"
          },
          {
            "value": "h"
          },
          {
            "value": "d"
          },
          {
            "value": "wk"
          },
          {
            "value": "mo"
          },
          {
            "value": "yr"
          }
        ]
      },
      {
        "name": "precision",
        "type": "select",
        "default": 4,
        "options": [
          {
            "value": 0
          },
          {
            "value": 2
          },
          {
            "value": 4
          },
          {
            "value": 6
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "unit": "",
        "precisionField": "precision",
        "unitField": "__resultUnit",
        "trimTrailingZeros": true,
        "notation": "auto"
      },
      {
        "name": "seconds",
        "precision": 3,
        "unit": "s",
        "showWhen": {
          "to": [
            "ms",
            "min",
            "h",
            "d",
            "wk",
            "mo",
            "yr"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "hours",
        "precision": 6,
        "unit": "h",
        "showWhen": {
          "to": [
            "ms",
            "s",
            "min",
            "d",
            "wk",
            "mo",
            "yr"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "days",
        "precision": 6,
        "unit": "days",
        "notation": "auto",
        "showWhen": {
          "to": [
            "ms",
            "s",
            "min",
            "h",
            "wk",
            "mo",
            "yr"
          ]
        }
      }
    ],
    "interpret": null
  }
}
