패키지, 저장소 및 앱 카테고리 검색

패키지 상세v6.4.5

jiffy

Jiffy는 날짜와 시간을 분석하고 조작하며 쿼리하고 형식화하기 위한 플러터(안드로이드, iOS 및 웹)용 날짜/시간 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
40.6만
좋아요
1.2천
Pub 점수
150

패키지 설치

flutter pub add jiffy

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Jiffy는 Android, iOS, Web, macOS, Windows, Linux를 포함한 여러 플랫폼에서 날짜 및 시간 작업을 처리하기 위한 포괄적인 Flutter 패키지입니다. 직관적인 API를 통해 날짜의 파싱, 조작, 쿼리 및 형식 지정을 간소화합니다. 개발자들이 가볍지만 강력한 솔루션을 찾는 데 적합하도록 설계되었으며, 국제화를 지원하고 Flutter 애플리케이션에서 날짜를 쉽게 다룰 수 있도록 유연한 문법을 제공합니다.

사용 사례

  • ISO 및 사용자 지정 날짜 문자열 파싱
  • 표시를 위한 날짜 형식 지정
  • 날짜 조작(일수 및 월수 더하기/빼기)
  • 시간 차이 계산
  • 국제화된 날짜 형식
  • 시간대 변환 처리

주요 기능

  • 유창하고 읽기 쉬운 API
  • 여러 플랫폼을 지원합니다
  • 내장형 국제화
  • 간단한 날짜 연산
  • 풍부한 형식 지정 옵션
  • 시간대 인식 작업

적합한 대상

  • 강력한 날짜 처리가 필요한 플러터 앱
  • 간결한 날짜 문법을 원하는 개발자
  • 날짜 현지화가 필요한 프로젝트
  • 크로스 플랫폼 날짜/시간 기능
  • 복잡한 날짜 로직을 가진 앱

고려 사항

  • 간단한 날짜 요구 사항에 대해 오버헤드가 발생할 수 있습니다
  • 로케일 설정에 대한 이해 필요
  • 내부적으로 Dart의 DateTime에 제한됨
  • 고주파 날짜 계산에 적합하지 않음
  • 고급 기능에 대한 설명이 더 자세했으면 좋겠습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Jiffy

Continuous Integration codecov License: MIT Pub Version Platform

Jiffy is a Flutter (Android, IOS and Web) date time package for parsing, manipulating, querying and formatting dates and time

Full Documentation | API Reference | Installation | ChangeLog | Examples
Discussions

Usage

Format Dates

Jiffy.parse('2021/01/19').format(pattern: 'MMMM do yyyy, h:mm:ss a'); // January 19th 2021, 12:00:00 AM
Jiffy.now().format(pattern: 'EEEE'); // Tuesday
Jiffy.now().format(pattern: 'MMM do yy'); // Mar 2nd 21
Jiffy.now().format(pattern: 'yyyy [escaped] yyyy'); // 2021 escaped 2021
Jiffy.now().format(); // 2021-03-02T15:18:29.922343

Jiffy.parseFromList([2020, 10, 19]).yMMMMd; // January 19, 2021

Jiffy.parseFromMap({
  Unit.year: 2020,
  Unit.month: 10,
  Unit.day: 19,
  Unit.hour: 19
}).dMMMMEEEEyjm; // Monday, October 19, 2020 7:14 PM

//  You can also use pre-set formats
Jiffy.parse('19, Jan 2021', pattern: 'dd, MMM yyyy').yMMMMd; // January 19, 2021
Jiffy.now().yMMMMEEEEdjm; // Tuesday, March 2, 2021 3:20 PM

Relative Time

// From X
Jiffy.parse('1997/09/23').from(Jiffy.parse('2002/10/26')); // 5 years ago
// From Now
Jiffy.parse('1997/09/23').fromNow(); // 25 years ago

// To X
Jiffy.parse('1997/09/23').to(Jiffy.parse('2002/10/26')); // in 5 years
// To Now
Jiffy.parse('1997/09/23').toNow(); // in 25 years

Manipulation

var jiffy = Jiffy.now().add(days: 1);
jiffy.yMMMMd; // March 3, 2021

Jiffy.now().subtract(days: 1).yMMMMd; // March 2, 2021

Jiffy.now()
  .add(hours: 3, days: 1)
  .subtract(minutes: 30, months: 1)
  .yMMMMEEEEdjm; // Wednesday, February 3, 2021 6:07 PM

Jiffy.parse('1997/09/23')
    .startOf(Unit.year)
    .yMMMMEEEEd; // Wednesday, January 1, 1997

Jiffy.parse('1997/09/23')
    .endOf(Unit.month)
    .yMMMMEEEEd; // Tuesday, September 30, 1997

Querying

Jiffy.parse('1997/9/23').isBefore(Jiffy.parse('1997/9/24')); // true

Jiffy.parse('1997/9/23').isAfter(Jiffy.parse('1997/9/20')); // true

Jiffy.parse('1997/9/23').isSame(Jiffy.parse('1997/9/23')); // true

Jiffy.parse('1997/9/23')
  .isBetween(Jiffy.parse('1997/9/20'), Jiffy.parse('1997/9/24')); // true

Locale Support

// Get current locale code, by default it is en_us
Jiffy.now().localeCode; // en_US

// Setting your preferred locale
await Jiffy.setLocale('fr_ca');
Jiffy.now().yMMMMEEEEdjm; // dimanche 26 février 2023 12 h 03

await Jiffy.setLocale('ja');
Jiffy.now().yMMMMEEEEdjm; // 2023年2月26日日曜日 12:02

await Jiffy.setLocale('zh_cn');
Jiffy.now().yMMMMEEEEdjm; // 2023年2月26日星期日 下午12:03

Contributing

For contribution guidelines, see CONTRIBUTING.

Support

Reach out to me at one of the following places!

  • Email me at [jama3137@gmail.com](mailto:jama3137@gmail.com)
  • LinkedIn Jama Mohamed

License

MIT License

Copyright (c) 2019 Jama Mohamed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위