mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	* Create PHP CS Fixer config and add to CI workflow * Run php cs fixer on project * Add newline at end of file * Update to use PHP CS Fixer v3 * Run v3 config on project * Run seperate config in CI
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Crater\Space;
 | |
| 
 | |
| use Carbon\Carbon;
 | |
| 
 | |
| class DateFormatter
 | |
| {
 | |
|     protected static $formats = [
 | |
|         [
 | |
|             "carbon_format" => "Y M d",
 | |
|             "moment_format" => "YYYY MMM DD",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "d M Y",
 | |
|             "moment_format" => "DD MMM YYYY",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "d/m/Y",
 | |
|             "moment_format" => "DD/MM/YYYY",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "d.m.Y",
 | |
|             "moment_format" => "DD.MM.YYYY",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "d-m-Y",
 | |
|             "moment_format" => "DD-MM-YYYY",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "m/d/Y",
 | |
|             "moment_format" => "MM/DD/YYYY",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "Y/m/d",
 | |
|             "moment_format" => " YYYY/MM/DD",
 | |
|         ],
 | |
|         [
 | |
|             "carbon_format" => "Y-m-d",
 | |
|             "moment_format" => "YYYY-MM-DD",
 | |
|         ],
 | |
|     ];
 | |
| 
 | |
|     public static function get_list()
 | |
|     {
 | |
|         $new = [];
 | |
| 
 | |
|         foreach (static::$formats as $format) {
 | |
|             $new[] = [
 | |
|                 "display_date" => Carbon::now()->format($format['carbon_format']) ,
 | |
|                 "carbon_format_value" => $format['carbon_format'],
 | |
|                 "moment_format_value" => $format['moment_format'],
 | |
|             ];
 | |
|         }
 | |
| 
 | |
|         return $new;
 | |
|     }
 | |
| }
 |