week_of_year
2.2.0, released 3 years ago by kada.se
Adds extension methods to get the ISO 8601 week of year from a DateTime object.
What it does
Adds extension methods to Dart's DateTime object to easily retrieve the ISO 8601 week of year, ordinal date, and whether it is a leap year. It also provides a utility function to create a DateTime from a given year, week number, and weekday.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display or calculate the ISO 8601 week number from a DateTime object.
- You need to check if a year is a leap year or get the ordinal date.
Skip it when
- You are already using a heavy datetime library that natively supports ISO week numbers.
Strengths
- Fast and dependency-free
- Simple extension-based API
- Supports Dart 3 and null safety
Weaknesses
- Extremely narrow scope limited to ISO week calculations
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:week_of_year/week_of_year.dart';
void main() {
final date = DateTime.now();
print(date.weekOfYear);
print(date.ordinalDate);
print(date.isLeapYear);
}Alternatives
Packages that do the same job and could replace week_of_year.
- week_number
Extension methods to get the week number and ordinal date from a DateTime object.
50Compare - awesome_extensions
A comprehensive collection of Dart and Flutter extensions to reduce boilerplate code.
82Compare - package_signature
Retrieve Android package signature (SHA1/SHA256) in a Flutter app.
66Compare - isoweek
Lightweight Dart package providing the Week class based on the ISO 8601 format.
49Compare
Works with
Packages commonly used together with week_of_year: ones it builds on, ones built on it, and its own family.