This has to do with how the data providers work in Sitecore and as mentioned in the linked SO post above, is useful for distinguishing "preview" modes.
If you enable what in Sitecore is known as "Live Mode", this is what it does.
LiveMode.config.disabled in a vanilla Sitecore installation:
This setting specifies whether Live Mode will filter out items that have publishing restrictions.
This is what is filtering your items in your example. Valid From and Valid To are
While not in your example, Sitecore would also return NULL for items that are in a workflow state that is not
final. This setting toggles that behaviour.
What I normally do locally, is have 2 sites configured, pointing to my
"master" database. One which is "normal" and one running true
You could do the same, or just add the above 2 attributes to your site definition.