prayer-timetable / adhan_dart

MIT License
13 stars 3 forks source link

get prayer time data for 7 days? #5

Open bagusandrewijaya opened 1 year ago

ench0 commented 1 year ago

If you look at the test examples at https://github.com/prayer-timetable/adhan_dart/blob/master/test/test.dart you will see the line

  DateTime date = tz.TZDateTime.from(DateTime.now(), location);

... that gives you prayer times, etc, for the current date (today, in this case).

You can use something like this for yesterday:

  DateTime date = tz.TZDateTime.from(DateTime.now().subtract(Duration(days: 1)), location);

A day before yesterday:

  DateTime date = tz.TZDateTime.from(DateTime.now().subtract(Duration(days: 2)), location);

Specific day:

  DateTime date = tz.TZDateTime.from(DateTime(2023, 11, 1, 15, 0), location);

You get the idea :-)