hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | /** |
| 2 | * The creation instant embedded in a UUIDv7 id (its first 48 bits are unix |
| 3 | * milliseconds), or `null` for any other id. |
| 4 | * |
| 5 | * Only for ordering records the backend gives no date for — an exam that was |
| 6 | * never scheduled still sorts by when it was created. Never shown as a date: |
| 7 | * it says when the row was made, not when anything happened. |
| 8 | */ |
| 9 | export function uuidV7Ms(id: string): number | null { |
| 10 | const match = /^([0-9a-f]{8})-([0-9a-f]{4})-7[0-9a-f]{3}-/i.exec(id); |
| 11 | if (!match) return null; |
| 12 | return Number.parseInt(match[1] + match[2], 16); |
| 13 | } |