Rinse and sort the beans. If desired, soak the beans in cold water for 4 to 8 hours.
Place the beans in a large pot and cover with fresh cold water by 3 inches. Add the onion, garlic, and bay leaves and bring to a boil over high heat; let boil for 10 to 15 minutes.
Lower the heat to a simmer and cook gently, uncovered, until the beans are tender, 45 minutes to 2 hours. Add hot water, as needed, to keep the beans covered.
While the beans are simmering, char the Anaheim chile over a burner on your stovetop or under the broiler until completely charred.
Transfer to a resealable plastic bag (or, place in a bowl and cover with a plate) and let sit for 15 minutes. Once cool enough to handle, use a paper towel to remove the skin. Finely chop the chile and discard the seeds and stem.
In a large saucepan or Dutch oven, cook the bacon over moderate heat, stirring occasionally, until it’s crispy and browned, 10 to 20 minutes.
Using a slotted spoon, transfer one-quarter of the bacon to a paper towel-lined plate to drain. Reserve for garnishing. Pour out some of the bacon fat, if desired.
In the saucepan, add the minced onion and cook over moderate heat until translucent, about 5 minutes.
Add the garlic and cook until fragrant, about 1 minute.
Add the chile powder, cumin, and mustard powder and cook, stirring occasionally, until fragrant, about 1 minute.
Stir in the tomato puree, beer, coffee, dates, and diced chile. Season with salt and pepper.
Bring the sauce to a boil, then reduce the heat to low and simmer, stirring occasionally, until the sauce is thickened and the dates are beginning to break down, 30 to 40 minutes.
Drain the beans, reserving 1 cup of the cooking liquid. Discard the onion, garlic, and bay leaves.
Return the beans to the pot. Stir in the sauce and the reserved cooking liquid and cook over low heat until heated through. Season with salt.
Transfer the beans to a serving bowl and garnish with the reserved bacon, white onion, and a spoonful of Mexican crema, if desired. Serve right away.
