For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/llms-full.txt, and this page is available as Markdown at https://open-spaced-repetition.github.io/ts-fsrs/zh-CN/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 天,与之前的卡片无关。