( timestamp?: TimestampProtoEs, defaultValue = Date.now() )
| 2 | |
| 3 | // Helper functions for proto-es timestamps (which use bigint for seconds) |
| 4 | export const getTimeForPbTimestampProtoEs = ( |
| 5 | timestamp?: TimestampProtoEs, |
| 6 | defaultValue = Date.now() |
| 7 | ): number => { |
| 8 | if (!timestamp) { |
| 9 | return defaultValue; |
| 10 | } |
| 11 | return Number(timestamp.seconds) * 1000 + timestamp.nanos / 1000000; |
| 12 | }; |
| 13 | |
| 14 | export const getDateForPbTimestampProtoEs = ( |
| 15 | timestamp?: TimestampProtoEs |
no outgoing calls
no test coverage detected