ludic/ns-date.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
3.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Date — Ludic</title>
<meta name="description" content="Calendar days on the proleptic Gregorian calendar (UTC).">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Date</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Date</h1></div>
<p class="ns-blurb">Calendar days on the proleptic Gregorian calendar (UTC). A <code>Date</code> is stored as a plain <code>int</code>: the count of days since 1970-01-01, so shifting a date by whole days is ordinary integer arithmetic and two dates subtract to a day count. Build one with <code>Date.new</code>, read its parts with <code>year</code>/<code>month</code>/<code>day</code>/<code>weekday</code>. Every operation is deterministic integer math — no leap seconds, no timezone, no floating point.</p>
<div class="ns-methods"><a class="ns-method" href="date-new.html"><code class="nm-sig">Date.new(year, month, day) -&gt; int</code><span class="nm-tip">A calendar day as days-since-1970.</span></a><a class="ns-method" href="date-year.html"><code class="nm-sig">Date.year(date) -&gt; int</code><span class="nm-tip">The calendar year of a date.</span></a><a class="ns-method" href="date-month.html"><code class="nm-sig">Date.month(date) -&gt; int</code><span class="nm-tip">The month (1-12) of a date.</span></a><a class="ns-method" href="date-day.html"><code class="nm-sig">Date.day(date) -&gt; int</code><span class="nm-tip">The day of the month (1-31) of a date.</span></a><a class="ns-method" href="date-weekday.html"><code class="nm-sig">Date.weekday(date) -&gt; int</code><span class="nm-tip">Day of the week, 0=Sunday..6=Saturday.</span></a><a class="ns-method" href="date-is_leap.html"><code class="nm-sig">Date.is_leap(year) -&gt; bool</code><span class="nm-tip">True if the year is a leap year.</span></a><a class="ns-method" href="date-days_in_month.html"><code class="nm-sig">Date.days_in_month(year, month) -&gt; int</code><span class="nm-tip">Number of days in a given month.</span></a><a class="ns-method" href="date-to_epoch.html"><code class="nm-sig">Date.to_epoch(date) -&gt; int</code><span class="nm-tip">Midnight UTC of the day, as a DateTime.</span></a><a class="ns-method" href="date-add_days.html"><code class="nm-sig">Date.add_days(date, n) -&gt; int</code><span class="nm-tip">The date n days later (n may be negative).</span></a><a class="ns-method" href="date-diff_days.html"><code class="nm-sig">Date.diff_days(a, b) -&gt; int</code><span class="nm-tip">Whole days from b to a (a - b).</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>