* fix: getLowestRoomPrice throws when given unexpected data * dont track lowestRoomPrice if unavailable Approved-by: Hrishikesh Vaipurkar
11 lines
262 B
TypeScript
11 lines
262 B
TypeScript
import { dt } from "@scandic-hotels/common/dt"
|
|
|
|
export function calculateNumberOfNights(
|
|
fromDate: string | Date | undefined,
|
|
toDate: string | Date | undefined
|
|
): number {
|
|
if (!fromDate || !toDate) return 0
|
|
|
|
return dt(toDate).diff(dt(fromDate), "day")
|
|
}
|