Skip to content
pubscout

week_number

1.1.1, released 2 years ago by sousyokunotomonokai.com

Extension methods to get the week number and ordinal date from a DateTime object.

WASM-ready
$ flutter pub add week_number
Source repository

What it does

Adds fast, dependency-free extension methods to Dart's DateTime object to compute ISO 8601 or Western Traditional week numbers. It also provides functions to create DateTime objects from year and week numbers or ordinal dates.

AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to calculate ISO 8601 or Western Traditional week numbers from DateTime objects.
  • You want to convert ordinal dates or week numbers back into DateTime instances.

Skip it when

  • You need heavy internationalization or full calendar localization beyond standard week systems.

Strengths

  • Dependency-free
  • Supports both ISO 8601 and Western Traditional systems
  • Includes helper functions for ordinal dates and leap years

Weaknesses

  • Very narrow scope focused only on week numbers and ordinal dates

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:week_number/iso.dart';

void main() {
  final date = DateTime.now();
  print(date.weekNumber);
  print(date.ordinalDate);
  print(date.isLeapYear);
}

Alternatives

Packages that do the same job and could replace week_number.