Al-Kāfi - Volume 1 > The Imams (a.s.) do have the knowledge of what was and will be, and that nothing is unknown to them (a.s.)
Hadith #2

2ـ عِدَّةٌ مِنْ أَصْحَابِنَا عَنْ أَحْمَدَ بْنِ مُحَمَّدٍ عَنْ مُحَمَّدِ بْنِ سِنَانٍ عَنْ يُونُسَ بْنِ يَعْقُوبَ عَنِ الْحَارِثِ بْنِ الْمُغِيرَةِ وَعِدَّةٍ مِنْ أَصْحَابِنَا مِنْهُمْ عَبْدُ الاعْلَى وَأَبُو عُبَيْدَةَ وَعَبْدُ الله بْنُ بِشْرٍ الْخَثْعَمِيُّ سَمِعُوا أَبَا عَبْدِ الله (عَلَيْهِ السَّلام) يَقُولُ إِنِّي لاعْلَمُ مَا فِي السَّمَاوَاتِ وَمَا فِي الارْضِ وَأَعْلَمُ مَا فِي الْجَنَّةِ وَأَعْلَمُ مَا فِي النَّارِ وَأَعْلَمُ مَا كَانَ وَمَا يَكُونُ قَالَ ثُمَّ مَكَثَ هُنَيْئَةً فَرَأَى أَنَّ ذَلِكَ كَبُرَ عَلَى مَنْ سَمِعَهُ مِنْهُ فَقَالَ عَلِمْتُ ذَلِكَ مِنْ كِتَابِ الله عَزَّ وَجَلَّ إِنَّ الله عَزَّ وَجَلَّ يَقُولُ فِيهِ تِبْيَانُ كُلِّ شَيْ‏ءٍ.

2. A number of our people has narrated from Ahmad ibn Muhammad ibn Sinan from Yunus ibn Ya‘qub from al-Harith ibn al-Mughirah and a group of our people, among whom were ‘Abd al-A‘la’, abu ‘Ubaydah and ‘Abdallah ibn Bishr al-Khath‘ami, who have said that they heard abu ‘Abdallah (a.s.) say the following. “I certainly know what is the heavens and what is in the earth. I know what is in paradise and what is the fire. I know what was there and what will be there.” The narrator has said that the Imam (a.s.) paused for a while and found that what he had just said was much heavy for the audience then he (a.s.) said, “I learned all of it from the book of Allah, the Most Holy, the Most High. Allah, the Most Holy, the Most High, has said, “In it there is the clarification of all things.”