try to fix syntax highlighting on GitHub

This commit is contained in:
Sami Samhuri 2015-03-16 18:07:52 -07:00
parent 30fd95dbba
commit 1d4365f3d5
2 changed files with 10 additions and 3 deletions

View file

@ -14,6 +14,7 @@ The headline feature is a huge performance boost resulting from [this contest](h
Along with this the API has been unified and cleaned up. `strftimeTZ`, `strftimeUTC`, and `localizedStrftime` have all been deprecated in favour of the following functions: `timezone(tz)`, `utc()`, and `localize(locale)`. You use them like so:
```JavaScript
var strftime = require('strftime'); // not required in web browsers
var strftimeIT = strftime.localize(anItalianLocale);
@ -25,6 +26,7 @@ Along with this the API has been unified and cleaned up. `strftimeTZ`, `strftime
// And chain them all at once
var strftimeIT_PST = strftime.localize(anItalianLocale).timezone('-0800');
```
The previous API is deprecated and will be removed for v1.0. The good news is that the previous API is supported by adapting the new API, so you get most of the performance benefits before you even update your code to use the new API.

View file

@ -33,13 +33,16 @@ Now you only need the single object exported and you can create a specialized ve
Usage
=====
```JavaScript
var strftime = require('strftime') // not required in browsers
console.log(strftime('%B %d, %Y %H:%M:%S')) // => April 28, 2011 18:21:08
console.log(strftime('%F %T', new Date(1307472705067))) // => 2011-06-07 18:51:45
```
If you want to localize it:
```JavaScript
var strftime = require('strftime') // not required in browsers
var it_IT = {
days: ['domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato'],
@ -65,25 +68,27 @@ If you want to localize it:
var strftimeIT = strftime.localize(it_IT)
console.log(strftimeIT('%B %d, %Y %H:%M:%S')) // => aprile 28, 2011 18:21:08
console.log(strftimeIT('%B %d, %Y %H:%M:%S', new Date(1307472705067))) // => giugno 7, 2011 18:51:45
```
Time zones can be passed in as an offset from GMT in minutes.
```JavaScript
var strftime = require('strftime') // not required in browsers
var strftimePDT = strftime.timezone(-420)
var strftimeCEST = strftime.timezone(120)
console.log(strftimePDT('%B %d, %y %H:%M:%S', new Date(1307472705067))) // => June 07, 11 11:51:45
console.log(strftimeCEST('%F %T', new Date(1307472705067))) // => 2011-06-07 20:51:45
```
Alternatively you can use the timezone format used by ISO 8601, `+HHMM` or `-HHMM`.
```JavaScript
var strftime = require('strftime') // not required in browsers
var strftimePDT = strftime.timezone('-0700')
var strftimeCEST = strftime.timezone('+0200')
console.log(strftimePDT('', new Date(1307472705067))) // => June 07, 11 11:51:45
console.log(strftimeCEST('%F %T', new Date(1307472705067))) // => 2011-06-07 20:51:45
```
Supported Specifiers
====================