It depends on whether you are storing your features as geometry or geography data type and the projection in the former case. If you are using geography or have a projection that puts the dateline in the middle of the map, then there is no problem with calculating distance. However, if you are using geometry data type with most projections (where the dateline is at the east and west extremes of the projection extent) then measuring across the dateline will give unexpected results because the measurement will follow Cartesian space and not go beyond the extents of the projection but remain within its bounds. For example, if you want to measure from locations at the equivalents of 179.9 degrees to -179.9 degrees then the measurement would go west to east (the long way) and not east to west (the more direct distance).
So, to summarize, distance measurement is not always a problem across the ante-meridian (which is actually where the issue lies and not the dateline, which is a similar but different thing) but can be if you are not careful and explicit about your requirements.
In PostGIS you can just cast geometry to geography on the fly though. See the linked documentation, which contains more information on poles and dateline (ante-meridian).