Needless Patchouli Manufacture

    carbonjs
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    carbonjs Tweet

    Typescript ready date library alternative to Moment.js

    Npm Version TypeScript Version Build Status Coverage Status Package Quality Npm Total Downloads Npm Monthly Downloads npm bundle size (minified) npm bundle size (minified + gzip) Open Issues Closed Issues Tested With Jest Known Vulnerabilities Dependencies Status Pull Requests License Github Stars Github Forks

    Carbon.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with a largely Moment.js-compatible API.

    Table of Content

    Features

    • 🕒 Familiar Moment.js API & patterns
    • 💪 Immutable
    • 🔥 Chainable
    • 🌐 I18n support
    • ⚙️ Plugin support
    • ⚙️ Calendar support (as part of plugin support)

    Getting Started

    Installation

    npm i -s carbonjs

    Usage

    API

    It's easy to use Carbon.js APIs to parse, validate, manipulate, and display dates and times.

    import * as Carbon from "carbonjs";
     
    Carbon.parse("2018-08-08"); // parse
     
    new Carbon().format("{YYYY} MM-DDTHH:mm:ss SSS [Z] A"); // display
     
    Carbon.parse().set("month", 3).month(); // get & set
     
    new Carbon().add(1, "year"); // manipulate
     
    Carbon.parse().isBefore(Carbon.parse()); // query

    I18n

    Day.js has great support for internationalization.

    But none of them will be included in your build unless you use it.

    import "carbonjs/lib/locales/es"; // load locale package on demand
     
    Carbon.locale("es"); // use Spanish locale globally
     
    Carbon.parse("2018-05-05").locale("zh-cn").format(); // use Chinese Simplified locale in a specific instance

    Plugin

    A plugin is an independent module that can be added to Day.js to extend functionality or add new features.

    import * as advancedFormat from 'carbonjs/lib/plugins/advancedFormat' // load on demand
     
    Carbon.extend(advancedFormat) // use plugin
     
    Carbon.parse().format('Q Do k kk X x') // more available formats

    📚Full API Reference

    Versioning

    We use SemVer for versioning. For the versions available, see the tags on this repository.

    Authors

    See also the list of contributors who participated in this project.

    License

    This project is licensed under the MIT License - see the LICENSE file for details

    Support

    If my work helps you, please consider

    Become A Patron

    Buy Me A Coffee

    Install

    npm i carbonjs

    DownloadsWeekly Downloads

    21

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    60.5 kB

    Total Files

    78

    Last publish

    Collaborators

    • ardalanamini