GithubHelp home page GithubHelp logo

litejs / date-format-lite Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 7.0 113 KB

Format, parse and manipulate dates in JavaScript

Home Page: http://www.litejs.com/date-format-lite/

JavaScript 99.45% TypeScript 0.55%

date-format-lite's Introduction

date-format-lite's People

Contributors

lauriro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

date-format-lite's Issues

Nice, but won't work with TypeScript

TypeScript see this as an error ...

            var now: Date = new Date();
            var d = now.format("iso");   

Error Build: Property 'format' does not exist on type 'Date'.

`Z` placeholder should output with minutes (:mm) always

Currently, if a time zone is round hours difference, the minutes (:00) are omitted from the output (for e.g: 2015-12-16T22:06:16+07).

That may be a valid ISO 8601 format. However, it's not compatible with native JavaScript Date parsing. (new Date('2015-12-16T22:06:16+07') will return an invalid Date object, I tried this in latest Chrome and Safari Preview).

I think that for compatibility sake and it doesn't harm for Z placeholder should always return a full +hh:mm string, OR, provide another placeholder character that always output the full +hh:mm.

Refer to https://www.w3.org/TR/NOTE-datetime, they always use +hh:mm for time zone designator.

format('YYYYMMDDHHMMss') results in 2015Mon090355

It appears that this particular format string does not work unless I'm missing something.

(new Date("2015-03-16T13:45:55")).format('YYYYMMDDHHMMss')
//'2015Mon090355'

I would expect it should be 20150316090355.

null value .date() exception

var mydate = ....;
want output mydate.date().format(....);
But if mydate value = null
exception can not convert null to date ................

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.