| Total Complexity | 3 |
| Complexity/F | 0 |
| Lines of Code | 28 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { format, parseISO } from 'date-fns'; |
||
| 2 | |||
| 3 | export const minutesToHours = (value: number): string => { |
||
| 4 | const hours = Math.floor(value / 60); |
||
| 5 | const minutes = value % 60; |
||
| 6 | |||
| 7 | if (hours === 0) { |
||
| 8 | return `${value}m`; |
||
| 9 | } |
||
| 10 | |||
| 11 | if (minutes === 0) { |
||
| 12 | return `${hours}h`; |
||
| 13 | } |
||
| 14 | |||
| 15 | return `${hours}h${minutes}`; |
||
| 16 | }; |
||
| 17 | |||
| 18 | export const formatDate = (value: Date | string): string => { |
||
| 19 | if (typeof value === 'string') { |
||
| 20 | value = parseISO(value); |
||
| 21 | } |
||
| 22 | return format(value, 'dd/MM/yyyy'); |
||
| 23 | }; |
||
| 24 | |||
| 25 | export const formatHtmlDate = (value: Date): string => { |
||
| 26 | return format(value, 'yyyy-MM-dd'); |
||
| 27 | }; |
||
| 28 |