dateformat
Advanced tools
Comparing version 1.0.4-1.2.3 to 1.0.5-1.2.3
@@ -16,3 +16,3 @@ /* | ||
var dateFormat = function () { | ||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZW]|"[^"]*"|'[^']*'/g, | ||
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|"[^"]*"|'[^']*'/g, | ||
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, | ||
@@ -51,2 +51,13 @@ timezoneClip = /[^-+\dA-Z]/g, | ||
return 1 + weekDiff; | ||
}, | ||
/** | ||
* Get ISO-8601 numeric representation of the day of the week | ||
* 1 (for Monday) through 7 (for Sunday) | ||
*/ | ||
getDayOfWeek = function(date){ | ||
var dow = date.getDay(); | ||
if(dow === 0) dow = 7; | ||
return dow; | ||
}; | ||
@@ -93,2 +104,3 @@ | ||
W = getWeek(date), | ||
N = getDayOfWeek(date), | ||
flags = { | ||
@@ -122,3 +134,4 @@ d: d, | ||
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10], | ||
W: W | ||
W: W, | ||
N: N | ||
}; | ||
@@ -125,0 +138,0 @@ |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.0.4-1.2.3", | ||
"version": "1.0.5-1.2.3", | ||
"main": "./lib/dateformat", | ||
@@ -15,0 +15,0 @@ "dependencies": {}, |
@@ -9,2 +9,3 @@ # dateformat | ||
* Added a `module.exports = dateFormat;` statement at the bottom | ||
* Added the placeholder `N` to get the ISO 8601 numeric representation of the day of the week | ||
@@ -63,2 +64,7 @@ ## Usage | ||
// 42 | ||
// and also get the ISO 8601 numeric representation of the day of the week: | ||
dateFormat(now,"N"); | ||
// 6 | ||
## License | ||
@@ -65,0 +71,0 @@ |
11076
7
204
74