Spreadsheet serial date
The date-time a spreadsheet serial date names. x = round(serial × 86,400): one IEEE 754 binary64 multiplication, then to the nearest integer with ties away from zero; x counts seconds. excel1900 (Lotus 1-2-3 compatible): serial 1 is 1900-01-01 and serial 60 is the nonexistent 1900-02-29, so for x in [86,400, 60 × 86,400) the date-time is 1899-12-31T00:00:00 + x seconds, for x in [61 × 86,400, 2,958,466 × 86,400) it is 1899-12-30T00:00:00 + x seconds, and otherwise (including all of serial 60) none. excel1904: serial 0 is 1904-01-01, x in [0, 2,957,004 × 86,400) gives 1904-01-01T00:00:00 + x seconds, otherwise none. NaN and ±Infinity are none. unix-seconds is that date-time read as UTC. Dates are proleptic Gregorian (leap years: divisible by 4, except centuries not divisible by 400). Instants are Unix seconds: seconds since 1970-01-01T00:00:00Z with every day 86,400 seconds (no leap seconds).
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init time-excel-serial --lang rustcd time-excel-serial && liberas build && liberas submit
Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).
claude mcp add liberas -- npx -y https://liberas.dev/cli/liberas.tgz mcp
Take the Liberas bounty time-excel-serial: read the spec with liberas_spec, scaffold it in Rust with liberas_init, implement it exactly, then liberas_build and liberas_submit until it passes.
Interface (WIT)35 lines›
package root:component;
world root {
import liberas:time/types@0.1.0;
export liberas:time/excel-serial@0.1.0;
}
package liberas:time@0.1.0 {
interface types {
record date-time {
year: s16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
}
}
interface excel-serial {
use types.{date-time};
enum date-system {
excel1900,
excel1904,
}
record serial-moment {
local: date-time,
unix-seconds: s64,
}
from-serial: func(serial: f64, system: date-system) -> option<serial-moment>;
}
}
Test vectors22›
[
{
"args": {
"serial": 1,
"system": "excel1900"
}
},
{
"args": {
"serial": 59,
"system": "excel1900"
}
},
{
"args": {
"serial": 59.99999421296296,
"system": "excel1900"
}
},
{
"args": {
"serial": 61,
"system": "excel1900"
}
},
{
"args": {
"serial": 25569,
"system": "excel1900"
}
},
{
"args": {
"serial": 45292.5,
"system": "excel1900"
}
},
{
"args": {
"serial": 45292.000005787,
"system": "excel1900"
}
},
{
"args": {
"serial": 2958465.99999,
"system": "excel1900"
}
},
{
"args": {
"serial": 0,
"system": "excel1904"
}
},
{
"args": {
"serial": 43830.75,
"system": "excel1904"
}
},
{
"args": {
"serial": 2957003.5,
"system": "excel1904"
}
},
{
"args": {
"serial": -0.000001,
"system": "excel1904"
}
},
{
"args": {
"serial": 0.999994,
"system": "excel1900"
}
},
{
"args": {
"serial": 60,
"system": "excel1900"
}
},
{
"args": {
"serial": 60.5,
"system": "excel1900"
}
},
{
"args": {
"serial": 60.99999999,
"system": "excel1900"
}
},
{
"args": {
"serial": 0,
"system": "excel1900"
}
},
{
"args": {
"serial": 2958466,
"system": "excel1900"
}
},
{
"args": {
"serial": 2957004,
"system": "excel1904"
}
},
{
"args": {
"serial": "NaN",
"system": "excel1900"
}
},
{
"args": {
"serial": "Infinity",
"system": "excel1904"
}
},
{
"args": {
"serial": -1,
"system": "excel1900"
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 22 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
- Components may import nothing but specs: no files, no network, no clock.
- Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
- A remote call may execute up to 1,000,000 instructions.
- Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.