ComPDF React Native - v3.0.0
    Preparing search index...

    Class CPDFDateUtil

    Utility class for date and time formatting, specifically for CPDFTextStamp.

    Index

    Constructors

    Methods

    • Formats the current date and time based on switches.

      Parameters

      • params: { timeSwitch: boolean; dateSwitch: boolean }
        • timeSwitch: boolean

          Whether to include time in the output

        • dateSwitch: boolean

          Whether to include date in the output

      Returns string

      Formatted date/time string

      // Returns: "2025/12/29"
      CPDFDateUtil.formatDateTime({ timeSwitch: false, dateSwitch: true });

      // Returns: "14:30:45"
      CPDFDateUtil.formatDateTime({ timeSwitch: true, dateSwitch: false });

      // Returns: "2025/12/29 14:30:45"
      CPDFDateUtil.formatDateTime({ timeSwitch: true, dateSwitch: true });

      // Returns: ""
      CPDFDateUtil.formatDateTime({ timeSwitch: false, dateSwitch: false });
    • Gets a formatted timestamp for CPDFTextStamp. This is an alias for formatDateTime.

      Parameters

      • params: { timeSwitch: boolean; dateSwitch: boolean }
        • timeSwitch: boolean

          Whether to include time in the output

        • dateSwitch: boolean

          Whether to include date in the output

      Returns string

      Formatted date/time string

      const timestamp = CPDFDateUtil.getTextStampDate({
      timeSwitch: true,
      dateSwitch: true
      });

      const textStamp = new CPDFTextStamp({
      content: 'Approved',
      date: timestamp,
      shape: CPDFTextStampShape.rect,
      color: CPDFTextStampColor.blue
      });