| 1414 | * @returns A UTC date representing midnight UTC on that calendar date |
| 1415 | */ |
| 1416 | export function createUTCDateFromLocalCalendarDate(localDate: Date): Date { |
| 1417 | // Extract the local date components |
| 1418 | const year = localDate.getFullYear(); |
| 1419 | const month = localDate.getMonth(); |
| 1420 | const day = localDate.getDate(); |
| 1421 | |
| 1422 | // Create a UTC date for that calendar date |
| 1423 | return new Date(Date.UTC(year, month, day, 0, 0, 0, 0)); |
| 1424 | } |
| 1425 | |
| 1426 | /** |
| 1427 | * Checks if a UTC-anchored date object represents the user's local "today". |