# toSeconds()

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 {
    toSeconds (timeframe: string): number | undefined;
}
  • Example 1
import { MidaTimeframe, } from "@reiryoku/mida";

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

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

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

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