NF_Fields_Date

Class NF_Fields_Date.

Defined (1)

The class is defined in the following location(s).

/includes/Fields/Date.php  
  1. class NF_Fields_Date extends NF_Fields_Textbox 
  2. protected $_name = 'date'; 
  3.  
  4. protected $_nicename = 'Date'; 
  5.  
  6. protected $_section = 'common'; 
  7.  
  8. protected $_icon = 'calendar'; 
  9.  
  10. protected $_type = 'date'; 
  11.  
  12. protected $_templates = 'date'; 
  13.  
  14. protected $_test_value = '12/12/2022'; 
  15.  
  16. protected $_settings = array( 'date_default', 'date_format', 'year_range' ); 
  17.  
  18. protected $_settings_exclude = array( 'default', 'placeholder', 'input_limit_set', 'disable_input' ); 
  19.  
  20. public function __construct() 
  21. parent::__construct(); 
  22.  
  23. $this->_nicename = __( 'Date', 'ninja-forms' ); 
  24.  
  25. public function process( $field, $data ) 
  26. return $data; 
  27.  
  28. private function get_format( $format ) 
  29. $lookup = array( 
  30. 'MM/DD/YYYY' => __( 'm/d/Y', 'ninja-forms' ),  
  31. 'MM-DD-YYYY' => __( 'm-d-Y', 'ninja-forms' ),  
  32. 'MM.DD.YYYY' => __( 'm.d.Y', 'ninja-forms' ),  
  33. 'DD/MM/YYYY' => __( 'm/d/Y', 'ninja-forms' ),  
  34. 'DD-MM-YYYY' => __( 'd-m-Y', 'ninja-forms' ),  
  35. 'DD.MM.YYYY' => __( 'd.m.Y', 'ninja-forms' ),  
  36. 'YYYY-MM-DD' => __( 'Y-m-d', 'ninja-forms' ),  
  37. 'YYYY/MM/DD' => __( 'Y/m/d', 'ninja-forms' ),  
  38. 'YYYY.MM.DD' => __( 'Y.m.d', 'ninja-forms' ),  
  39. 'dddd, MMMM D YYYY' => __( 'l, F d Y', 'ninja-forms' ),  
  40.  
  41.  
  42.  
  43.  
  44. ); 
  45.  
  46. return ( isset( $lookup[ $format ] ) ) ? $lookup[ $format ] : $format; 
  47.