श्रेणियाँ, पैकेज और रिपॉज़िटरी खोजें

पैकेज विवरणv2.3.0

calendar_time

MomentJS के कैलेंडर समय का कार्यान्वयन, और कई अन्य सहायक विधियाँ।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
124
लाइक
27
Pub अंक
130

पैकेज इंस्टॉल करें

flutter pub add calendar_time

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक Flutter/Dart पैकेज जो MomentJS के कैलेंडर समय प्रारूपण को लागू करता है, जिसमें '2 घंटे में' या '2 दिन पहले' जैसे उपयोगकर्ता-अनुकूल सापेक्ष समय प्रदर्शन शामिल है। इसमें तारीख के संशोधन और प्रारूपण के लिए अतिरिक्त सहायक विधियाँ भी शामिल हैं, जो उपयोगकर्ता-उन्मुख एप्लिकेशन में समयचिह्नों के साथ काम करने में आसानी प्रदान करते हैं। क्रॉस-प्लेटफॉर्म उपयोग के लिए डिज़ाइन किया गया है, जो Android, iOS, Web, macOS, Windows और Linux का समर्थन करता है। यह पैकेज समय अंतर को मानव-पठनीय रूप में प्रस्तुत करने को सरल बनाता है, जो डायनामिक समय प्रदर्शन की आवश्यकता वाले एप्लिकेशन में UX को बढ़ाता है।

उपयोग

  • चैट ऐप्स में सापेक्ष समय स्टैम्प प्रदर्शित करना
  • सोशल फीड में पोस्ट या गतिविधि की उम्र दिखाएं
  • नोटिफिकेशन में समय अंतर को प्रारूपित करना
  • पठनीय समय लेबल के साथ उपयोगकर्ता अनुभव में सुधार
  • कार्य प्रबंधन ऐप में तिथि तर्क को सरल बनाना

मुख्य विशेषताएँ

  • MomentJS-शैली कैलेंडर समय प्रारूपण
  • क्रॉस-प्लेटफॉर्म संगतता
  • तिथि संचालन के लिए सहायक विधियाँ
  • पठनीय समय अभिव्यक्तियाँ
  • pub add कमांड के माध्यम से आसान एकीकरण

इनके लिए उपयुक्त

  • सापेक्ष समय प्रदर्शन की आवश्यकता वाले ऐप्स
  • MomentJS के परिचय वाले विकासकर्ता
  • समय प्रारूपण की स्थिरता की आवश्यकता वाले परियोजनाएँ
  • वास्तविक समय में अपडेट के साथ UI-भारी एप्लिकेशन
  • विकासक उत्पादकता पर ध्यान केंद्रित टीमें

विचार योग्य बातें

  • सापेक्ष समय अवधारणाओं को समझने की आवश्यकता है
  • गैर-अंग्रेजी क्षेत्रों के लिए स्थानीयकरण सेटअप की आवश्यकता हो सकती है
  • समय प्रारूपण तक सीमित — पूर्ण तिथि विश्लेषण नहीं
  • Dart के मूल DateTime वर्ग पर निर्भर करता है
  • जटिल तारीख गणना के लिए उपयुक्त नहीं

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

calendar_time

Implementation of MomentJS's calendarTime function and some other helpful utilities.

I expect this project will get replaced with another more ambitious project in the future, but this has come in very handy. Extensions and pull requests welcome.

Usage

toHuman

Converting a DateTime to a human readable string

import 'package:calendar_time/calendar_time.dart';

main(){
  CalendarTime(DateTime.now()).toHuman; //Today at {current time}
}

Example output:

  • Today at {current time}
  • Tomorrow at {time}
  • Yesterday at {time}
  • {day} at {time}
  • Last {day} at {time}
  • date time (outside of the last or upcoming few weeks)

Honestly just check the code, but it is in line with Moment's logic.

You can also call .toHumanMultiLine that splits the output around at to have date and time on different lines.

format

Formats to current timezone

import 'package:calendar_time/calendar_time.dart';

main(){
  CalendarTime(DateTime.now()).format("yyyy-MM-dd HH:mm");
}

See https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html for options.

isToday

Return if the supplied DateTime is today

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.isToday; //true
}
isTomorrow

Return if the supplied DateTime is tomorrow

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.isTomorrow; //false
}
isNextWeek

Return if the supplied DateTime is next week

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.isNextWeek; //false
}
isYesterday

Return if the supplied DateTime is yesterday

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.isYesterday; //false
}
isLastweek

Return if the supplied DateTime is last week

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.isLastWeek; //false
}
startOfToday

Return the beginning of today - not to be confused with startOfDay

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.startOfToday; // DateTime
}
startOfDay

Return the beginning of the day of the CalendarTime obejct.

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime(2020,1,1));
  calendarTime.startOfDay; // 2020/01/01 0:0:0am
}
startOfYesterday

Return the beginning of yesterday

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.startOfYesterday; // DateTime start of yesterday
}
startOfLastWeek

Return the beginning of lastWeek

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.startOfLastWeek; // DateTime start of yesterday
}
endOfToday

Return the end of today (23:59:59:999:999) - not to be confused with endOfDay

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.endOfToday; // DateTime
}
endOfDay

Return the end of the day of the CalendarTime object (23:59:59:999:999)

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime(2020, 1,1));
  calendarTime.endOfToday; // 2020/01/01 23:59:59:999:999
}
endOfTomorrow

Return the end of tomorrow

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.endOfTomorrow; // DateTime
}
endOfNextWeek

Return the end of next week

import 'package:calendar_time/calendar_time.dart';

main(){
  final calendarTime = CalendarTime(DateTime.now());
  calendarTime.endOfNextWeek; // DateTime
}

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 1 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।