( options?: StartOfYesterdayOptions<ContextDate> | undefined, )
| 29 | * //=> Sun Oct 5 2014 00:00:00 |
| 30 | */ |
| 31 | export function startOfYesterday<ContextDate extends Date>( |
| 32 | options?: StartOfYesterdayOptions<ContextDate> | undefined, |
| 33 | ): ContextDate { |
| 34 | const now = constructNow(options?.in); |
| 35 | const year = now.getFullYear(); |
| 36 | const month = now.getMonth(); |
| 37 | const day = now.getDate(); |
| 38 | |
| 39 | const date = constructNow(options?.in); |
| 40 | date.setFullYear(year, month, day - 1); |
| 41 | date.setHours(0, 0, 0, 0); |
| 42 | return date; |
| 43 | } |