Unicode MessageFormat for JavaScript
    Preparing search index...

    Variable DraftFunctionsBeta

    DraftFunctions: {
        currency: (
            ctx: MessageFunctionContext,
            exprOpt: Record<string | symbol, unknown>,
            operand?: unknown,
        ) => MessageNumber;
        date: (
            ctx: MessageFunctionContext,
            options: Record<string, unknown>,
            operand?: unknown,
        ) => MessageDateTime;
        datetime: (
            ctx: MessageFunctionContext,
            options: Record<string, unknown>,
            operand?: unknown,
        ) => MessageDateTime;
        percent: (
            ctx: MessageFunctionContext,
            exprOpt: Record<string | symbol, unknown>,
            operand?: unknown,
        ) => MessageNumber;
        time: (
            ctx: MessageFunctionContext,
            options: Record<string, unknown>,
            operand?: unknown,
        ) => MessageDateTime;
        unit: (
            ctx: MessageFunctionContext,
            exprOpt: Record<string | symbol, unknown>,
            operand?: unknown,
        ) => MessageNumber;
    } = ...

    Functions classified as DRAFT by the LDML 47 MessageFormat specification.

    These are liable to change, and are not covered by any stability guarantee.

    import { MessageFormat } from 'messageformat';
    import { DraftFunctions } from 'messageformat/functions';

    const mf = new MessageFormat(locale, msgsrc, { functions: DraftFunctions });

    Type declaration

    • currency: (
          ctx: MessageFunctionContext,
          exprOpt: Record<string | symbol, unknown>,
          operand?: unknown,
      ) => MessageNumber

      Supports formatting as defined in LDML 47 for the :currency function.

      The operand must be a number, BigInt, or string representing a JSON number, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

      The currency option must be provided by either the operand's options or the exprOpt expression options.

    • date: (
          ctx: MessageFunctionContext,
          options: Record<string, unknown>,
          operand?: unknown,
      ) => MessageDateTime

      Supports formatting as defined in LDML 47 for the :date function.

      The operand must be a Date, number, or string representing a date, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

    • datetime: (
          ctx: MessageFunctionContext,
          options: Record<string, unknown>,
          operand?: unknown,
      ) => MessageDateTime

      Supports formatting as defined in LDML 47 for the :datetime function.

      The operand must be a Date, number, or string representing a date, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

    • percent: (
          ctx: MessageFunctionContext,
          exprOpt: Record<string | symbol, unknown>,
          operand?: unknown,
      ) => MessageNumber

      Supports formatting as defined in LDML 48 for the :percent function.

      The operand must be a number, BigInt, or string representing a JSON number, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

    • time: (
          ctx: MessageFunctionContext,
          options: Record<string, unknown>,
          operand?: unknown,
      ) => MessageDateTime

      Supports formatting as defined in LDML 47 for the :time function.

      The operand must be a Date, number, or string representing a date, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

    • unit: (
          ctx: MessageFunctionContext,
          exprOpt: Record<string | symbol, unknown>,
          operand?: unknown,
      ) => MessageNumber

      Supports formatting as defined in LDML 47 for the :unit function.

      The operand must be a number, BigInt, or string representing a JSON number, or an object wrapping such a value, with a valueOf() accessor and an optional options object.

      The unit option must be provided by either the operand's options or the exprOpt expression options.