evert / Sector path SVG generator
0 вподобань
0 форк(-ів)
1 файл(-ів)
Остання активність 2 years ago
| 1 | function getSectorPath(centre, rIn, rOut, startDeg, delta) { |
| 2 | const startOut = { |
| 3 | x: centre.x + rOut * Math.cos(startDeg), |
| 4 | y: centre.y + rOut * Math.sin(startDeg) |
| 5 | }; |
| 6 | const endOut = { |
| 7 | x: centre.x + rOut * Math.cos(startDeg + delta), |
| 8 | y: centre.y + rOut * Math.sin(startDeg + delta) |
| 9 | }; |
| 10 | const startIn = { |
evert / TypeScript accurate date difference calculator
0 вподобань
0 форк(-ів)
1 файл(-ів)
Остання активність 2 years ago
| 1 | // https://stackoverflow.com/a/49201872 |
| 2 | const calcDateDifference = ( |
| 3 | start: string | Date, |
| 4 | end: string | Date |
| 5 | ): { year: number; month: number; day: number } => { |
| 6 | // Convert to true dates without time |
| 7 | let startDate = new Date(new Date(start).toISOString().substring(0, 10)); |
| 8 | let endDate = new Date( |
| 9 | (end ? new Date(end) : new Date()).toISOString().substring(0, 10) |
| 10 | ); |
Новіше
Пізніше