moved fetching of date inside btn click listener