{
  "address": "4a7ea29599fbd053377815d25a262e5b",
  "category": "other",
  "question": "What day of the year is 2024-03-01, and how many days remain in that year?",
  "answer": "Day 61 of 366; 305 days remaining in the year",
  "askedBy": {
    "kind": "guest",
    "display": "method deck",
    "stamped": false,
    "id": null
  },
  "answeredBy": "method",
  "madeAt": "2026-09-30T22:39:30.722Z",
  "validUntil": null,
  "validityClass": "forever",
  "sources": [
    {
      "label": "chrono-Compatible Low-Level Date Algorithms",
      "url": "https://howardhinnant.github.io/date_algorithms.html"
    }
  ],
  "supersedes": null,
  "supersededBy": null,
  "isSeed": false,
  "seedSource": null,
  "seedAttribution": null,
  "duplicateOfQid": null,
  "publishedAt": null,
  "unpublishedAt": null,
  "voteCount": 0,
  "queuedForSubstrate": false,
  "answerMethod": "method",
  "unsourced": false,
  "source": {
    "kind": "url",
    "value": "https://howardhinnant.github.io/date_algorithms.html",
    "retrieved_utc": "2026-09-30T19:41:35Z"
  },
  "qsha256": "68aa58ba676ddf065a0dd83990e30ff67cd566036e5c19210b61b4a81cd3c331",
  "runOne": null,
  "cardContractVersion": "card_contract/1",
  "deck_id": "method-deck",
  "deck_title": "Method Deck",
  "method": {
    "name": "Day of year and days remaining",
    "version": "1",
    "source_url_or_file": "methods/day-of-year-and-days-remaining.cjs",
    "sha256_of_method_file": "09ba5314b5d4ca8115a7edcc1f2b4a0e3b330d8f55cc6c234964bb1150260ddb"
  },
  "receipt": {
    "inSubstrate": false,
    "local": true,
    "modelCallsAtMint": 0,
    "tokensAtMint": 0
  },
  "method_deck": {
    "inputs": [
      {
        "name": "date",
        "type": "string",
        "format": "date",
        "required": true,
        "description": "ISO 8601 date, YYYY-MM-DD"
      }
    ],
    "outputs": [
      {
        "name": "day_of_year",
        "unit": "days",
        "description": "Ordinal day within the year, 1 to 365 or 366"
      },
      {
        "name": "days_remaining",
        "unit": "days",
        "description": "Days left in the calendar year after this date"
      }
    ],
    "steps": [
      "Parse the date as a proleptic Gregorian civil date.",
      "Convert the date and January 1 of the same year to Julian Day Numbers (Hinnant days_from_civil, cited above).",
      "day_of_year = JDN(date) - JDN(year, 1, 1) + 1.",
      "days_in_year = 366 if the year is a Gregorian leap year, else 365.",
      "days_remaining = days_in_year - day_of_year."
    ],
    "constants": [],
    "examples": [
      {
        "name": "worked example",
        "inputs": {
          "date": "2024-03-01"
        },
        "expected": {
          "answer": "Day 61 of 366; 305 days remaining in the year"
        },
        "check": "2024 is a leap year: January has 31 days and February has 29, so March 1 is day 31+29+1 = 61 of 366"
      },
      {
        "name": "test vector: last day of a non-leap year",
        "inputs": {
          "date": "2023-12-31"
        },
        "expected": {
          "answer": "Day 365 of 365; 0 days remaining in the year"
        },
        "check": "2023 is not a leap year, so it has 365 days and Dec 31 is the last one"
      },
      {
        "name": "test vector: first day of year",
        "inputs": {
          "date": "2026-01-01"
        },
        "expected": {
          "answer": "Day 1 of 365; 364 days remaining in the year"
        },
        "check": "2026 is not a leap year (not divisible by 4); January 1 is always day 1"
      }
    ],
    "disclaimer": null,
    "deck_category": "dates"
  },
  "status": "minted",
  "kind": "method",
  "provenanceClass": "own_question",
  "provenance": {
    "schema": "card_provenance/2.0.0",
    "chain": [
      {
        "source": {
          "kind": "url",
          "value": "https://howardhinnant.github.io/date_algorithms.html",
          "retrieved_utc": "2026-09-30T19:41:35Z"
        },
        "sha256": "8ad3429df92ceff60488dc2d31d0ecb188bfa8880c0784259eb5a0ace924a353",
        "supersedes": null,
        "added_utc": "2026-09-30T22:39:30.722Z",
        "added_by": "method:Day of year and days remaining",
        "why": "the method that computed this answer",
        "check": null,
        "status_label": "pending",
        "signature": null
      }
    ]
  }
}
