Calling `network.optimize()` when `pendulum.DateTime` objects are used as network snapshots 
## Checklist

- [x] I am using the current [`master`](https://github.com/pypsa/pypsa/tree/master) branch.

## Describe the Bug

I have a model where `network.snapshots` is a list of `pendulum.DateTime` objects. This works fine when solving using `network.lopf()`, but not with `network.optimize` (see error below). From what I can see the problem arises from a difference between `network.model.parameters.snapshots` and `network.snapshots`.

The error does not occur if I use a `pandas.DateTimeIndex` from `pd.date_range` instead of the pendulum datetimes.

```python
import pandas as pd
import numpy as np
import pypsa
import pendulum

dts = list((pendulum.datetime(2022, 10, 2) - pendulum.datetime(2022, 10, 1)).range("minutes", 30))
df_load = pd.DataFrame({"value": np.random.randn(len(dts)) * 10 + 100}, index=dts)

network = pypsa.Network(snapshots=dts)

network.add("Bus", "B1")
network.add("Load", "L1", bus="B1", p_set=df_load.value)
network.add("Generator", "G1", bus="B1", p_nom=100, marginal_cost=100)
network.add("Generator", "G2", bus="B1", p_nom=50, marginal_cost=150)

# This does not work: see error below
network.optimize(network.snapshots, solver_name="highs")

# This works
network.lopf(network.snapshots, pyomo=False, solver_name="highs")

print(network.model.parameters.snapshots)
# <xarray.DataArray 'snapshots' (snapshot: 49)>
# array([1664582400000000000, 1664584200000000000, 1664586000000000000,
#        1664587800000000000, 1664589600000000000, 1664591400000000000,
#        1664593200000000000, 1664595000000000000, 1664596800000000000,
#        1664598600000000000, 1664600400000000000, 1664602200000000000,

print(network.snapshots)
# DatetimeIndex(['2022-10-01 00:00:00+00:00', '2022-10-01 00:30:00+00:00',
#                '2022-10-01 01:00:00+00:00', '2022-10-01 01:30:00+00:00',
#                '2022-10-01 02:00:00+00:00', '2022-10-01 02:30:00+00:00',
#                '2022-10-01 03:00:00+00:00', '2022-10-01 03:30:00+00:00',
#                '2022-10-01 04:00:00+00:00', '2022-10-01 04:30:00+00:00',
```

This appears to be related to timezone information, i.e. I can work around the issue by setting:
```python
dts = [d.replace(tzinfo=None) for d in (pendulum.datetime(2022, 10, 2) - pendulum.datetime(2022, 10, 1)).range("minutes", 30)]
```

## Error Message

```
File ~/miniconda3/envs/spike-pypsa/lib/python3.9/site-packages/pypsa/optimization/optimize.py:337, in post_processing(n)
    333     weightings = n.snapshot_weightings.objective.mul(
    334         period_weighting, level=0, axis=0
    335     ).loc[sns]
    336 else:
--> 337     weightings = n.snapshot_weightings.objective.loc[sns]
    339 n.buses_t.marginal_price.loc[sns] = n.buses_t.marginal_price.loc[sns].divide(
    340     weightings, axis=0
    341 )
    343 # load

...

KeyError: "None of [Int64Index([1664582400000000000, 1664584200000000000, 1664586000000000000,\\n            1664587800000000000, 1664589600000000000, 1664591400000000000,\\n            1664593200000000000, 1664595000000000000, 1664596800000000000,\\n            1664598600000000000, 1664600400000000000, 1664602200000000000,\\n            1664604000000000000, 1664605800000000000, 1664607600000000000,\\n            1664609400000000000, 1664611200000000000, 1664613000000000000,\\n            1664614800000000000, 1664616600000000000, 1664618400000000000,\\n            1664620200000000000, 1664622000000000000, 1664623800000000000,\\n            1664625600000000000, 1664627400000000000, 1664629200000000000,\\n            1664631000000000000, 1664632800000000000, 1664634600000000000,\\n            1664636400000000000, 1664638200000000000, 1664640000000000000,\\n            1664641800000000000, 1664643600000000000, 1664645400000000000,\\n            1664647200000000000, 1664649000000000000, 1664650800000000000,\\n            1664652600000000000, 1664654400000000000, 1664656200000000000,\\n            1664658000000000000, 1664659800000000000, 1664661600000000000,\\n            1664663400000000000, 1664665200000000000, 1664667000000000000,\\n            1664668800000000000],\\n           dtype='int64', name='snapshot')] are in the [index]"
```


diff --git a/pypsa/optimization/optimize.py b/pypsa/optimization/optimize.py
index 8fe2fafe..688a9a53 100644
--- a/pypsa/optimization/optimize.py
+++ b/pypsa/optimization/optimize.py
@@ -325,7 +325,7 @@ def post_processing(n):
     This calculates quantities derived from the optimized values such as
     power injection per bus and snapshot, voltage angle.
     """
-    sns = n.model.parameters.snapshots
+    sns = n.model.parameters.snapshots.to_index()
 
     # correct prices with objective weightings
     if n._multi_invest:
['pypsa/optimization/optimize.py']