2 strftime for Javascript
3 Copyright (c) 2008, Philip S Tellis <philip@bluesmoon.info>
6 This code is distributed under the terms of the BSD licence
8 Redistribution and use of this software in source and binary forms, with or without modification,
9 are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright notice, this list of conditions
12 and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice, this list of
14 conditions and the following disclaimer in the documentation and/or other materials provided
15 with the distribution.
16 * The names of the contributors to this file may not be used to endorse or promote products
17 derived from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * \author Philip S Tellis \<philip@bluesmoon.info\>
34 * \brief Javascript implementation of strftime
36 * Implements strftime for the Date object in javascript based on the PHP implementation described at
37 * http://www.php.net/strftime This is in turn based on the Open Group specification defined
38 * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
39 * include modified conversion specifiers (i.e., Ex and Ox)
41 * The following format specifiers are supported:
45 * \%a, \%A, \%b and \%B should be localised for non-English locales.
48 * This library may be used as follows:
52 * var ymd = d.strftime('%Y/%m/%d');
53 * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
57 * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
58 * \sa Date.ext.locales for localisation information
59 * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
60 * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
63 //! Date extension object - all supporting objects go in here.
70 \brief Left pad a number with something
71 \details Takes a number and pads it to the left with the passed in pad character
72 \param x The number to pad
73 \param pad The string to pad with
74 \param r [optional] Upper limit for pad. A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
77 \return The number left padded with the pad character. This function returns a string and not a number.
79 Date
.ext
.util
.xPad
=function(x
, pad
, r
)
81 if(typeof(r
) == 'undefined')
85 for( ; parseInt(x
, 10)<r
&& r
>1; r
/=10)
86 x
= pad
.toString() + x
;
91 \brief Currently selected locale.
93 The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
94 The default will be based on the lang attribute of the HTML tag of your document
96 Date
.prototype.locale
= 'en-GB';
98 if(document
.getElementsByTagName('html') && document
.getElementsByTagName('html')[0].lang
)
100 Date
.prototype.locale
= document
.getElementsByTagName('html')[0].lang
;
105 \brief Localised strings for days of the week and months of the year.
107 To create your own local strings, add a locale object to the locales object.
108 The key of your object should be the same as your locale name. For example:
113 Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
114 Your locale object must contain the following keys:
115 \param a Short names of days of week starting with Sunday
116 \param A Long names days of week starting with Sunday
117 \param b Short names of months of the year starting with January
118 \param B Long names of months of the year starting with February
119 \param c The preferred date and time representation in your locale
120 \param p AM or PM in your locale
121 \param P am or pm in your locale
122 \param x The preferred date representation for the current locale without the time.
123 \param X The preferred time representation for the current locale without the date.
125 \sa Date.ext.locales.en for a sample implementation
126 \sa \ref localisation for detailed documentation on localising strftime for your own locale
128 Date
.ext
.locales
= { };
131 * \brief Localised strings for English (British).
133 * This will be used for any of the English dialects unless overridden by a country specific one.
134 * This is the default locale if none specified
136 Date
.ext
.locales
.en
= {
137 a
: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
138 A
: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
139 b
: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
140 B
: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
141 c
: '%a %d %b %Y %T %Z',
149 // Localised strings for US English
150 Date
.ext
.locales
['en-US'] = Date
.ext
.locales
.en
;
151 Date
.ext
.locales
['en-US'].c
= '%a %d %b %Y %r %Z';
152 Date
.ext
.locales
['en-US'].x
= '%D';
153 Date
.ext
.locales
['en-US'].X
= '%r';
155 // Localised strings for British English
156 Date
.ext
.locales
['en-GB'] = Date
.ext
.locales
.en
;
158 // Localised strings for Australian English
159 Date
.ext
.locales
['en-AU'] = Date
.ext
.locales
['en-GB'];
162 //! \brief List of supported format specifiers.
165 * \arg \%a - abbreviated weekday name according to the current locale
166 * \arg \%A - full weekday name according to the current locale
167 * \arg \%b - abbreviated month name according to the current locale
168 * \arg \%B - full month name according to the current locale
169 * \arg \%c - preferred date and time representation for the current locale
170 * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
171 * \arg \%d - day of the month as a decimal number (range 01 to 31)
172 * \arg \%D - same as %m/%d/%y
173 * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
174 * \arg \%g - like %G, but without the century
175 * \arg \%G - The 4-digit year corresponding to the ISO week number
176 * \arg \%h - same as %b
177 * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
178 * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
179 * \arg \%j - day of the year as a decimal number (range 001 to 366)
180 * \arg \%m - month as a decimal number (range 01 to 12)
181 * \arg \%M - minute as a decimal number
182 * \arg \%n - newline character
183 * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
184 * \arg \%P - like %p, but lower case
185 * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
186 * \arg \%R - time in 24 hour notation equal to %H:%M
187 * \arg \%S - second as a decimal number
188 * \arg \%t - tab character
189 * \arg \%T - current time, equal to %H:%M:%S
190 * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
191 * \arg \%U - week number of the current year as a decimal number, starting with
192 * the first Sunday as the first day of the first week
193 * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
194 * range 01 to 53, where week 1 is the first week that has at least 4 days
195 * in the current year, and with Monday as the first day of the week.
196 * \arg \%w - day of the week as a decimal, Sunday being 0
197 * \arg \%W - week number of the current year as a decimal number, starting with the
198 * first Monday as the first day of the first week
199 * \arg \%x - preferred date representation for the current locale without the time
200 * \arg \%X - preferred time representation for the current locale without the date
201 * \arg \%y - year as a decimal number without a century (range 00 to 99)
202 * \arg \%Y - year as a decimal number including the century
203 * \arg \%z - numerical time zone representation
204 * \arg \%Z - time zone name or abbreviation
205 * \arg \%% - a literal `\%' character
208 a
: function(d
) { return Date
.ext
.locales
[d
.locale
].a
[d
.getDay()]; },
209 A
: function(d
) { return Date
.ext
.locales
[d
.locale
].A
[d
.getDay()]; },
210 b
: function(d
) { return Date
.ext
.locales
[d
.locale
].b
[d
.getMonth()]; },
211 B
: function(d
) { return Date
.ext
.locales
[d
.locale
].B
[d
.getMonth()]; },
213 C
: function(d
) { return Date
.ext
.util
.xPad(parseInt(d
.getFullYear()/100, 10), 0); },
216 g
: function(d
) { return Date
.ext
.util
.xPad(parseInt(Date
.ext
.util
.G(d
)/100, 10), 0); },
218 var y
= d
.getFullYear();
219 var V
= parseInt(Date
.ext
.formats
.V(d
), 10);
220 var W
= parseInt(Date
.ext
.formats
.W(d
), 10);
224 } else if(W
===0 && V
>=52) {
230 H
: ['getHours', '0'],
231 I
: function(d
) { var I
=d
.getHours()%12; return Date
.ext
.util
.xPad(I
===0?12:I
, 0); },
233 var ms
= d
- new Date('' + d
.getFullYear() + '/1/1 GMT');
234 ms
+= d
.getTimezoneOffset()*60000;
235 var doy
= parseInt(ms
/60000/60/24, 10)+1;
236 return Date
.ext
.util
.xPad(doy
, 0, 100);
238 m
: function(d
) { return Date
.ext
.util
.xPad(d
.getMonth()+1, 0); },
239 M
: ['getMinutes', '0'],
240 p
: function(d
) { return Date
.ext
.locales
[d
.locale
].p
[d
.getHours() >= 12 ? 1 : 0 ]; },
241 P
: function(d
) { return Date
.ext
.locales
[d
.locale
].P
[d
.getHours() >= 12 ? 1 : 0 ]; },
242 S
: ['getSeconds', '0'],
243 u
: function(d
) { var dow
= d
.getDay(); return dow
===0?7:dow
; },
245 var doy
= parseInt(Date
.ext
.formats
.j(d
), 10);
246 var rdow
= 6-d
.getDay();
247 var woy
= parseInt((doy
+rdow
)/7, 10);
248 return Date
.ext
.util
.xPad(woy
, 0);
251 var woy
= parseInt(Date
.ext
.formats
.W(d
), 10);
252 var dow1_1
= (new Date('' + d
.getFullYear() + '/1/1')).getDay();
253 // First week is 01 and not 00 as in the case of %U and %W,
254 // so we add 1 to the final result except if day 1 of the year
255 // is a Monday (then %W returns 01).
256 // We also need to subtract 1 if the day 1 of the year is
257 // Friday-Sunday, so the resulting equation becomes:
258 var idow
= woy
+ (dow1_1
> 4 || dow1_1
<= 1 ? 0 : 1);
259 if(idow
== 53 && (new Date('' + d
.getFullYear() + '/12/31')).getDay() < 4)
265 idow
= Date
.ext
.formats
.V(new Date('' + (d
.getFullYear()-1) + '/12/31'));
268 return Date
.ext
.util
.xPad(idow
, 0);
272 var doy
= parseInt(Date
.ext
.formats
.j(d
), 10);
273 var rdow
= 7-Date
.ext
.formats
.u(d
);
274 var woy
= parseInt((doy
+rdow
)/7, 10);
275 return Date
.ext
.util
.xPad(woy
, 0, 10);
277 y
: function(d
) { return Date
.ext
.util
.xPad(d
.getFullYear()%100, 0); },
280 var o
= d
.getTimezoneOffset();
281 var H
= Date
.ext
.util
.xPad(parseInt(Math
.abs(o
/60), 10), 0);
282 var M
= Date
.ext
.util
.xPad(o
%60, 0);
283 return (o
>0?'-':'+') + H
+ M
;
285 Z
: function(d
) { return d
.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
286 '%': function(d
) { return '%'; }
290 \brief List of aggregate format specifiers.
292 Aggregate format specifiers map to a combination of basic format specifiers.
293 These are implemented in terms of Date.ext.formats.
295 A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
299 Date
.ext
.aggregates
= {
313 // Cache timezone values because they will never change for a given JS instance
314 Date
.ext
.aggregates
.z
= Date
.ext
.formats
.z(new Date());
315 Date
.ext
.aggregates
.Z
= Date
.ext
.formats
.Z(new Date());
318 //! List of unsupported format specifiers.
321 * All format specifiers supported by the PHP implementation are supported by
322 * this javascript implementation.
324 Date
.ext
.unsupported
= { };
328 * \brief Formats the date according to the specified format.
329 * \param fmt The format to format the date in. This may be a combination of the following:
332 * \return A string representation of the date formatted based on the passed in parameter
333 * \sa http://www.php.net/strftime for documentation on format specifiers
335 Date
.prototype.strftime
=function(fmt
)
337 // Fix locale if declared locale hasn't been defined
338 // After the first call this condition should never be entered unless someone changes the locale
339 if(!(this.locale
in Date
.ext
.locales
))
341 if(this.locale
.replace(/-[a-zA-Z]+$/, '') in Date
.ext
.locales
)
343 this.locale
= this.locale
.replace(/-[a-zA-Z]+$/, '');
347 this.locale
= 'en-GB';
352 // First replace aggregates
353 while(fmt
.match(/%[cDhnrRtTxXzZ]/))
355 fmt
= fmt
.replace(/%([cDhnrRtTxXzZ])/g, function(m0
, m1
)
357 var f
= Date
.ext
.aggregates
[m1
];
358 return (f
== 'locale' ? Date
.ext
.locales
[d
.locale
][m1
] : f
);
363 // Now replace formats - we need a closure so that the date object gets passed through
364 var str
= fmt
.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0
, m1
)
366 var f
= Date
.ext
.formats
[m1
];
367 if(typeof(f
) == 'string') {
369 } else if(typeof(f
) == 'function') {
371 } else if(typeof(f
) == 'object' && typeof(f
[0]) == 'string') {
372 return Date
.ext
.util
.xPad(d
[f
[0]](), f
[1]);
382 * \mainpage strftime for Javascript
384 * \section toc Table of Contents
386 * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
388 * - \subpage format_specifiers
389 * - \subpage localisation
390 * - \link strftime.js API Documentation \endlink
392 * - \subpage changelog
394 * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
395 * - \subpage copyright_licence
397 * \section intro_sec Introduction
399 * C and PHP developers have had access to a built in strftime function for a long time.
400 * This function is an easy way to format dates and times for various display needs.
402 * This library brings the flexibility of strftime to the javascript Date object
404 * Use this library if you frequently need to format dates in javascript in a variety of ways. For example,
405 * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
406 * progressively enhanced javascript, then this library can do exactly what you want.
411 * \page usage Example usage
413 * \section usage_sec Usage
414 * This library may be used as follows:
416 * var d = new Date();
418 * var ymd = d.strftime('%Y/%m/%d');
419 * var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
423 * \subsection examples Examples
425 * To get the current time in hours and minutes:
427 * var d = new Date();
428 * d.strftime("%H:%M");
431 * To get the current time with seconds in AM/PM notation:
433 * var d = new Date();
437 * To get the year and day of the year for August 23, 2009:
439 * var d = new Date('2009/8/23');
440 * d.strftime("%Y-%j");
443 * \section demo_sec Demo
445 * Try your own examples on the \subpage demo page. You can use any of the supported
446 * \subpage format_specifiers.
451 * \page localisation Localisation
452 * You can localise strftime by implementing the short and long forms for days of the
453 * week and months of the year, and the localised aggregates for the preferred date
454 * and time representation for your locale. You need to add your locale to the
455 * Date.ext.locales object.
457 * \section localising_fr Localising for french
459 * For example, this is how we'd add French language strings to the locales object:
460 * \dontinclude index.html
461 * \skip Generic french
463 * The % format specifiers are all defined in \ref formats. You can use any of those.
465 * This locale definition may be included in your own source file, or in the HTML file
466 * including \c strftime.js, however it must be defined \em after including \c strftime.js
468 * The above definition includes generic french strings and formats that are used in France.
469 * Other french speaking countries may have other representations for dates and times, so we
470 * need to override this for them. For example, Canadian french uses a Y-m-d date format,
471 * while French french uses d.m.Y. We fix this by defining Canadian french to be the same
472 * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
475 * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
476 * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
478 * var d = new Date("2008/04/22");
481 * d.strftime("%A, %d %B == %x");
485 * mardi, 22 avril == 22.04.2008
487 * While changing the locale to "fr-CA":
489 * d.locale = "fr-CA";
491 * d.strftime("%A, %d %B == %x");
495 * mardi, 22 avril == 2008-04-22
498 * You can use any of the format specifiers defined at \ref formats
500 * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
501 * it is set, or to \c "en" otherwise.
503 * Your locale definitions \b MUST be added to the locale object before calling
504 * \link Date.prototype.strftime Date.strftime \endlink.
506 * \sa \ref formats for a list of format specifiers that can be used in your definitions
509 * \section locale_names Locale names
511 * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
512 * defined language code and an optional ISO3166 defined country code separated by a -
514 * eg: fr-FR, de-DE, hi-IN
516 * \sa http://www.ietf.org/rfc/rfc1766.txt
517 * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
518 * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
520 * \section locale_fallback Locale fallbacks
522 * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
523 * to fall back to the two letter language code. If a locale object corresponding to that isn't found
524 * either, then the locale will fall back to \c "en". No warning will be issued.
526 * For example, if we define a locale for de:
528 * Then set the locale to \c "de-DE":
530 * d.locale = "de-DE";
532 * d.strftime("%a, %d %b");
534 * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
539 * Swiss german will return the same since it will also fall back to \c "de":
541 * d.locale = "de-CH";
543 * d.strftime("%a, %d %b");
549 * We need to override the \c a specifier for Swiss german, since it's different from German german:
551 * We now get the correct results:
553 * d.locale = "de-CH";
555 * d.strftime("%a, %d %b");
561 * \section builtin_locales Built in locales
563 * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
568 * \page format_specifiers Format specifiers
570 * \section specifiers Format specifiers
571 * strftime has several format specifiers defined by the Open group at
572 * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
574 * PHP added a few of its own, defined at http://www.php.net/strftime
576 * This javascript implementation supports all the PHP specifiers
578 * \subsection supp Supported format specifiers:
581 * \subsection unsupportedformats Unsupported format specifiers:
582 * \copydoc unsupported
587 * \page demo strftime demo
588 * <div style="float:right;width:45%;">
591 * \htmlinclude index.html
598 * \section how_tos Usage
600 * \subsection howtouse Is there a manual on how to use this library?
602 * Yes, see \ref usage
604 * \subsection wheretoget Where can I get a minified version of this library?
606 * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
608 * \subsection which_specifiers Which format specifiers are supported?
610 * See \ref format_specifiers
614 * \subsection why_lib Why this library?
616 * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
617 * to do date formatting. When I needed to do date formatting in javascript, I decided
618 * that it made the most sense to just reuse what I'm already familiar with.
620 * \subsection why_another Why another strftime implementation for Javascript?
622 * Yes, there are other strftime implementations for Javascript, but I saw problems with
623 * all of them that meant I couldn't use them directly. Some implementations had bad
624 * designs. For example, iterating through all possible specifiers and scanning the string
625 * for them. Others were tied to specific libraries like prototype.
627 * Trying to extend any of the existing implementations would have required only slightly
628 * less effort than writing this from scratch. In the end it took me just about 3 hours
629 * to write the code and about 6 hours battling with doxygen to write these docs.
631 * I also had an idea of how I wanted to implement this, so decided to try it.
633 * \subsection why_extend_date Why extend the Date class rather than subclass it?
635 * I tried subclassing Date and failed. I didn't want to waste time on figuring
636 * out if there was a problem in my code or if it just wasn't possible. Adding to the
637 * Date.prototype worked well, so I stuck with it.
639 * I did have some worries because of the way for..in loops got messed up after json.js added
640 * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
642 * My last doubt was about the Date.ext namespace that I created. I still don't like this,
643 * but I felt that \c ext at least makes clear that this is external or an extension.
645 * It's quite possible that some future version of javascript will add an \c ext or a \c locale
646 * or a \c strftime property/method to the Date class, but this library should probably
647 * check for capabilities before doing what it does.
649 * \section curiosity Curiosity
651 * \subsection how_big How big is the code?
653 * \arg 26K bytes with documentation
654 * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
655 * \arg 1477 bytes minified and gzipped
657 * \subsection how_long How long did it take to write this?
659 * 15 minutes for the idea while I was composing this blog post:
660 * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
662 * 3 hours in one evening to write v1.0 of the code and 6 hours the same
663 * night to write the docs and this manual. As you can tell, I'm fairly
666 * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
669 * \section contributing Contributing
671 * \subsection how_to_rfe How can I request features or make suggestions?
673 * You can leave a comment on my blog post about this library here:
674 * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
676 * \subsection how_to_contribute Can I/How can I contribute code to this library?
678 * Yes, that would be very nice, thank you. You can do various things. You can make changes
679 * to the library, and make a diff against the current file and mail me that diff at
680 * philip@bluesmoon.info, or you could just host the new file on your own servers and add
681 * your name to the copyright list at the top stating which parts you've added.
683 * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
685 * \subsection copyright_signover Who owns the copyright on contributed code?
687 * The contributor retains copyright on contributed code.
689 * In some cases I may use contributed code as a template and write the code myself. In this
690 * case I'll give the contributor credit for the idea, but will not add their name to the
691 * copyright holders list.
696 * \page copyright_licence Copyright & Licence
698 * \section copyright Copyright
699 * \dontinclude strftime.js
703 * \section licence Licence
705 * \until SUCH DAMAGE.
709 * \page changelog ChangeLog
711 * \par 1.3 - 2008/06/17:
712 * - Fixed padding issue with negative timezone offsets in %r
713 * reported and fixed by Mikko <mikko.heimola@iki.fi>
714 * - Added support for %P
715 * - Internationalised %r, %p and %P
717 * \par 1.2 - 2008/04/27:
718 * - Fixed support for c (previously it just returned toLocaleString())
719 * - Add support for c, x and X
720 * - Add locales for en-GB, en-US and en-AU
721 * - Make en-GB the default locale (previous was en)
722 * - Added more localisation docs
724 * \par 1.1 - 2008/04/27:
725 * - Fix bug in xPad which wasn't padding more than a single digit
726 * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
727 * - Add support for g, G, U, V and W
729 * \par 1.0 - 2008/04/22:
730 * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %