Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


use conventional syntax for formatting #49

defunctzombie opened this Issue · 4 comments

3 participants


I don't know why you invented your own format specifiers, but things like stftime (and that family of methods) have a well known set of format specifiers. Would be nice if you could just use those instead of making new ones which won't match up to what someone may already be using.


There are too many different date format tokens syntaxes for me to match any standard.

See this comment. #36 (comment)

That explains my rationale for why I chose the tokens I did.

@timrwood timrwood closed this

I would think using the strftime notation would be quite reasonable as it would be found on all platforms in some form. The fact that things like unix, python, php, ruby, c/c++, etc all support it should tell you something :)

When looking for a simple date library to use over the builtin one, I would pick something that mimics strftime or just not bother personally.


The intention of this library is not to port strftime. It is to provide a safe and robust collection of common functionality regarding dates.

There are many implementations of strftime in javascript. A brief search on github found the following:

I'm not too experienced with formatting dates in unix, python, ruby, or c++, but I know php has both strftime and date for formatting dates, and the tokens for those functions vary wildly.

As described in the comment I linked to above, the reason I chose the tokens I did was to aid readability. I believe the tokens I chose would be much easier to remember or deduce than strftime tokens for someone who hasn't been exposed to either.

I don't mean to start an argument, hopefully you can understand my rationale for designing the library this way.


To revive a very old topic. I'm going to end up using the moment-strftime/moment-tokens library, simply because I need interoperability with Django's internationalisation code. Here's an example of some (admittedly horrible) JavaScript generated by the framework to aid in client-side internationalisation:

As you can see, it exposes the strftime syntax for date/time/datetime formatting, which the client-side code can use at will.

Not trying to reverse your decision, since your reasoning makes sense to me, but just providing a use case.

@butterflyhug butterflyhug referenced this issue from a commit in WhoopInc/frozen-moment-OLD
@timrwood timrwood docs for #49 ca22e44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.