#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) => numberReturns 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 天,與之前的卡片無關。