holiday_in 0.0.1 holiday_in: ^0.0.1 copied to clipboard
Indian Holidays.
This library uses holiday_in as Indian holiday dataset.
Features #
You can Use This Package to know about indian holidays
Getting started #
To use this plugin, add holiday_in as a dependency in your pubspec.yaml file.
Usage #
Use this Package for holidays
import 'package:holiday_in/holiday_in.dart' as holiday_in;
import 'package:intl/intl.dart';
final _formatter = DateFormat('yyyy-MM-dd');
void main(List<String> arguments) {
final marineDay = DateTime.utc(2020, 7, 23);
final holiday = holiday_in.getHoliday(marineDay);
if (holiday == null) {
throw Exception('holiday mus not be null');
}
print('${holiday.date} is ${holiday.nameEn} in Japan.\n');
final isMarineDayHoliday = holiday_jp.isHoliday(marineDay);
print(
'The question whether Marine Day is holiday or not is $isMarineDayHoliday.\n');
final start = DateTime.utc(2022, 1, 1);
final end = DateTime.utc(2022, 1, 15);
final holidays = holiday_in.between(start, end);
print(
'Holidays between ${_formatter.format(start)} and ${_formatter.format(end)} are the followings.');
for (final holiday in holidays) {
print('- ${holiday.date} is ${holiday.nameEn}');
}
}