For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/ja-JP/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/ja-JP/llms-full.txt, and this page is available as Markdown at https://open-spaced-repetition.github.io/ts-fsrs/ja-JP/guide/chrono/numeric.md.

Numeric

numericChrono は相対時間を使った実験に向いています。normalize は常に previous: 0 と current: time を返し、now() は 0 を返します。card や revlog に時刻フィールドを追加せず、カードの前回の復習日時も記録しません。Unix タイムスタンプをミリ秒のまま渡さず、経過日数を明示的に渡してください。復習を繰り返す用途では、時刻フィールドを保存する Chrono を定義できます。

プリセットを実行する

import { 
const numericChrono: Chrono<{
    readonly time: SRSSchema<{
        input: {};
        output: number;
    }>;
    readonly fields: {};
}>
numericChrono
} from 'ts-fsrs'
const
const clock: ChronoCore<number>
clock
=
const numericChrono: Chrono<{
    readonly time: SRSSchema<{
        input: {};
        output: number;
    }>;
    readonly fields: {};
}>
numericChrono
.
Chrono<{ readonly time: SRSSchema<{ input: {}; output: number; }>; readonly fields: {}; }>.create: () => ChronoCore<number>
create
()
console.log( JSON.stringify({ now:
const clock: ChronoCore<number>
clock
.
ChronoCore<number>.now: () => number
now
(),
elapsedDays:
const clock: ChronoCore<number>
clock
.
ChronoCore<number>.difference: (from: number, to: number) => number

Returns the distance from the previous review time to the current time.

difference
(1.25, 4.5),
nextTime:
const clock: ChronoCore<number>
clock
.
ChronoCore<number>.add: (from: number, days: number) => number
add
(4.5, 2.25),
normalize: StandardSchemaV1.Result<ChronoNormalizedTime<number>> | Promise<StandardSchemaV1.Result<ChronoNormalizedTime<number>>>
normalize
:
const numericChrono: Chrono<{
    readonly time: SRSSchema<{
        input: {};
        output: number;
    }>;
    readonly fields: {};
}>
numericChrono
.
Chrono<{ readonly time: SRSSchema<{ input: {}; output: number; }>; readonly fields: {}; }>.normalize: ChronoTimeNormalizer<{
    readonly time: SRSSchema<{
        input: {};
        output: number;
    }>;
    readonly fields: {};
}>
normalize
['~standard'].
StandardSchemaV1<Input = unknown, Output = Input>.Props<{ readonly time: number; }, ChronoNormalizedTime<number>>.validate: (value: unknown, options?: StandardSchemaV1<Input = unknown, Output = Input>.Options | undefined) => StandardSchemaV1.Result<ChronoNormalizedTime<number>> | Promise<StandardSchemaV1.Result<ChronoNormalizedTime<number>>>
validate
({ time: 4.5 }),
}) )

演算は日単位の数値をそのまま使います。normalize の起点はゼロなので、復習時刻に 4.5 を渡すと、前のカードに関係なく経過日数は4.5日になります。