Skip to the content

Tane種

Reproduce numbers from a seed, shuffle or pick items, share a daily puzzle and resume a saved stream.

Tane means seed in Japanese. About the name

Contents

Reference · React hooks

useDailySeedfunction

Today's day and seed, which change on their own at midnight in timeZone (UTC unless named): a page left open overnight moves to the new day's puzzle without a reload.

On the server this reads the server's clock; a page rendered just before midnight and hydrated just after will show the new day once it hydrates.

Import it

import { useDailySeed } from "@johnmorrisdotca/tane/react";

Definition

function useDailySeed(timeZone?: string): DailySeed

Parameters

NameTypeDescription
timeZone (optional)string

The IANA time-zone name; UTC when omitted.

Returns

DailySeed

The current calendar day and its seed for the named zone.

Examples

import { useDailySeed } from "@johnmorrisdotca/tane/react";

import { createElement } from "react";
function DailyPuzzle() {
  const today = useDailySeed("UTC");
  return createElement("p", null, `${today.day}: ${today.seed}`);
}
console.log(createElement(DailyPuzzle));

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tane 1.3.0.