搜尋套件、儲存庫與 APP 分類

套件詳情v2.2.0

week_of_year

新增擴展方法,從日期取得 ISO 8601 年度週數

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.5萬
喜歡數
47
Pub 分數
160

安裝套件

flutter pub add week_of_year

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

week_of_year 套件透過一個易用的方法擴展 Dart 的 DateTime 類別,以計算 ISO 8601 年度週數。它根據國際標準提供準確的週編號,確保在不同地區設定和日曆系統之間的一致性。適用於需要按週進行排程、報告或資料分組的應用程式。此套件輕量級、文件完整,並支援所有主要的 Flutter 平台。

適用情境

  • 每週報告
  • 日曆應用
  • 依週進行資料聚合
  • 排程工具
  • 國際日期合規性

主要特色

  • 符合 ISO 8601 標準
  • 簡單擴展方法
  • 跨平台支援
  • 精確的週編號
  • 最小依賴

適合對象

  • 需要 ISO 週數的開發人員
  • 每週數據追蹤的應用程式
  • 國際化日期處理
  • 輕量級日期工具

使用建議

  • 需要 Dart 2.12 或更高版本
  • 無需額外設定
  • 僅新增年中週功能
  • 不修改原始 DateTime 物件
  • 除了方法呼叫之外,沒有執行時間開銷

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

week_of_year

Fast dependency-free extension methods to get the ISO 8601 week of year from a dart DateTime object.

Also includes a function to create a DateTime from a year and week number.

import 'package:week_of_year/week_of_year.dart';

void main() {
  final date = DateTime.now();
  print(date.weekOfYear); // Get the iso week of year
  print(date.ordinalDate); // Get the ordinal date
  print(date.isLeapYear); // Is this a leap year?

  final DateTime dateFromWeekNumber = dateTimeFromWeekNumber(2023, 13, DateTime.tuesday);
  print(dateFromWeekNumber); // 2023-02-28
}

所屬分類

原始碼儲存庫

使用此套件的專案