Giter Site home page Giter Site logo

broklyngagah / jquery-format Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asual/jquery-format

0.0 1.0 0.0 5.76 MB

jQuery Format - Simplified dates and numbers

Home Page: http://www.asual.com/jquery/format

License: GNU General Public License v2.0

jquery-format's Introduction

jQuery Format

The jQuery Format plugin enables the formatting and parsing of dates and numbers. It's a client-side alternative of the popular SimpleDateFormat and NumberFormat APIs.

Usage

Formatting dates and numbers is as easy as the following:

$.format.date(new Date(), 'MMMM dd, yyyy KK:mm:ss:SSS a');
$.format.number(7456.2, '#,##0.00#');

Parsing is very similar to the formatting but works with strings as a first parameter:

$.format.date('1.5.2009', 'dd.MM.yyyy');
$.format.number('1.231.231.212,3241');

The second format parameter is always optional and by default the plugin uses the formats of the en_US locale. The locale can be globally configured using the following:

$.format.locale({
    date: {
        format: 'dddd, MMMM dd, yyyy h:mm:ss tt',
        monthsFull: ['January','February','March','April','May','June','July','August','September','October','November','December'],
        monthsShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
        daysFull: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
        daysShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
        timeFormat: 'h:mm tt',
        shortDateFormat: 'M/d/yyyy',
        longDateFormat: 'dddd, MMMM dd, yyyy'
    },
    number: {
        format: '#,##0.0#',
        groupingSeparator: ',',
        decimalSeparator: '.'
    }    
});

Changes

11/24/2011 - jQuery Format 1.2

  • Issue 8: Parsing string
  • Issue 5: Decimal rounding
  • Fixed issue with fraction formatting.

09/26/2010 - jQuery Format 1.1

  • Issue 3: Issue on rounding.
  • Issue 2: A semicolon is missing line 275.
  • Issue 1: Issue with number format #.## (or more).

12/23/2009 - jQuery Format 1.0

Initial release.

jquery-format's People

Contributors

asual avatar

Watchers

pieter lelaona avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.