Villager mechanics in 1.14. All this data has been deduced by using the following commands:
/data get entity @e[type=minecraft:villager,limit=1,sort=nearest] Brain.memories
/execute as orlp at orlp run tellraw @s {"nbt":"Brain.memories","entity":"@e[type=villager,sort=nearest,limit=1]"}
A villager is awake from 0-11999 and tries to sleep between 12000 and 23999.
A villager will claim a bed if: