PageSourceSearch

https://www.geneva.edu/_files/js/datemaker.js

js geneva.edu collected 2026-10-02 04:17:04 UTC 4,012 bytes, 117 lines download raw bytes

1
2/*
3 * Date Format 1.2.3
4 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
5 * MIT license
6 *
7 * Includes enhancements by Scott Trenda <scott.trenda.net>
8 * and Kris Kowal <cixar.com/~kris.kowal/>
9 *
10 * Accepts a date, a mask, or a date and a mask.
11 * Returns a formatted version of the given date.
12 * The date defaults to the current date/time.
13 * The mask defaults to dateFormat.masks.default.
14 */
15
16var now = new Date();
17var dateFormat = function () {
18 var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
19  timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
20  timezoneClip = /[^-+\dA-Z]/g,
21  pad = function (val, len) {
22   val = String(val);
23   len = len || 2;
24   while (val.length < len) val = "0" + val;
25   return val;
26  };
27 // Regexes and supporting functions are cached through closure
28 return function (date, mask, utc) {
29  var dF = dateFormat;
30  // You can't provide utc if you skip other args (use the "UTC:" mask prefix)
31  if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
32   mask = date;
33   date = undefined;
34  }
35  // Passing date through Date applies Date.parse, if necessary
36  date = date ? new Date(date) : new Date;
37  if (isNaN(date)) throw SyntaxError("invalid date");
38  mask = String(dF.masks[mask] || mask || dF.masks["default"]);
39  // Allow setting the utc argument via the mask
40  if (mask.slice(0, 4) == "UTC:") {
41   mask = mask.slice(4);
42   utc = true;
43  }
44  var _ = utc ? "getUTC" : "get",
45   d = date[_ + "Date"](),
46   D = date[_ + "Day"](),
47   m = date[_ + "Month"](),
48   y = date[_ + "FullYear"](),
49   H = date[_ + "Hours"](),
50   M = date[_ + "Minutes"](),
51   s = date[_ + "Seconds"](),
52   L = date[_ + "Milliseconds"](),
53   o = utc ? 0 : date.getTimezoneOffset(),
54   flags = {
55    d:    d,
56    dd:   pad(d),
57    ddd:  dF.i18n.dayNames[D],
58    dddd: dF.i18n.dayNames[D + 7],
59    m:    m + 1,
60    mm:   pad(m + 1),
61    mmm:  dF.i18n.monthNames[m],
62    mmmm: dF.i18n.monthNames[m + 12],
63    yy:   String(y).slice(2),
64    yyyy: y,
65    h:    H % 12 || 12,
66    hh:   pad(H % 12 || 12),
67    H:    H,
68    HH:   pad(H),
69    M:    M,
70    MM:   pad(M),
71    s:    s,
72    ss:   pad(s),
73    l:    pad(L, 3),
74    L:    pad(L > 99 ? Math.round(L / 10) : L),
75    t:    H < 12 ? "a"  : "p",
76    tt:   H < 12 ? "am" : "pm",
77    T:    H < 12 ? "A"  : "P",
78    TT:   H < 12 ? "AM" : "PM",
79    Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
80    o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
81    S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
82   };
83  return mask.replace(token, function ($0) {
84   return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
85  });
86 };
87}();
88// Some common format strings
89dateFormat.masks = {
90 "default":      "ddd mmm dd yyyy HH:MM:ss",
91 shortDate:      "m/d/yy",
92 mediumDate:     "mmm d, yyyy",
93 longDate:       "mmmm d, yyyy",
94 fullDate:       "dddd, mmmm d, yyyy",
95 shortTime:      "h:MM TT",
96 mediumTime:     "h:MM:ss TT",
97 longTime:       "h:MM:ss TT Z",
98 isoDate:        "yyyy-mm-dd",
99 isoTime:        "HH:MM:ss",
100 isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
101 isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
102};
103// Internationalization strings
104dateFormat.i18n = {
105 dayNames: [
106  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
107  "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
108 ],
109 monthNames: [
110  "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
111  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
111November", "December"
112 ]
113};
114// For convenience...
115Date.prototype.format = function (mask, utc) {
116 return dateFormat(this, mask, utc);
117};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.