# parseTimeframe()

Converts a string timeframe to number.

WARNING

Timeframes as strings must be in the Mida format: S*, M*, H*, W*, MO* or Y*

  • Interface
namespace MidaTimeframe {
    parseTimeframe (timeframe: string): number | undefined;
}
  • Example 1
import { MidaTimeframe, } from "@reiryoku/mida";

const M45 = MidaTimeframe.parseTimeframe("M3"); // <= 180
  • Example 2
import { MidaTimeframe, } from "@reiryoku/mida";

const M45 = MidaTimeframe.parseTimeframe("M45"); // <= 2700
  • Example 3
import { MidaTimeframe, } from "@reiryoku/mida";

const D3 = MidaTimeframe.parseTimeframe("D3"); // <= 259200
  • Example 4
import { MidaTimeframe, } from "@reiryoku/mida";

const Y1 = MidaTimeframe.parseTimeframe("D365"); // <= 31536000