/
CHANGELOG.txt
374 lines (233 loc) · 12.6 KB
/
CHANGELOG.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
CHANGE LOG
--------------------
2008-04-06 [geoffrey.mcgill]
Revision #152
1. Added Date.prototype.getWeek(). Gets the week number.
The first week of the year is the week which contains the first Thursday.
Monday is considered the first day of the week.
The .getWeek algorithm is a JavaScript port of the work presented by
Claus Tøndering at http://www.tonderingdk/claus/cal/node8.html#SECTION00880000000000000000
.getWeek() Algorithm Copyright (c) Claus Tondering.
The .getWeek() function does NOT convert the date to UTC. The local datetime is used.
Please use .getISOWeek() to get the week of the UTC converted date.
Returns a number from 1 to (52 or 53) depending on the year.
Example
Date.today().getWeek();
3. Added Date.prototype.getISOWeek(). Get the ISO 8601 week number.
Week one (1) is the week which contains the first Thursday of the year.
Monday is considered the first day of the week.
The .getISOWeek() function does convert the date to it's UTC value.
Please use .getWeek() to get the week of the local date.
4. Added Date.prototype.setWeek(). Moves the date of the current instance to Monday of the week set.
Accepts a number (1 to 53) that represents the week of the year to move to. Returns the date instance (this).
Example
Date.today().setWeek(1); // 1st week of year
5. Added a series of tests to /trunk/test/core/ to test for new .getWeek() and .setWeek() functions.
6. Removed non-plural config options from Date.prototype.add().
Example
// Old
Date.today().add({month: 1, day: 1, hours: 1}); // mixed pluralization was acceptable
// New
Date.today().add({months: 1, days: 1, hours: 1}); // Only plural config options now accepted.
7. Added 'week' as config option to .set().
Example
Date.today().set({week: 26});
8. Fixed bug where Date.parse("week 1") was not returning the correct date.
9. Removed final sugarpak.js dependency from within parser.js. Now the modules can be included in the following
order, with the preceding module required by the next.
1. CultureInfo
2. core.js
3. parser.js
4. sugarpak.js
10. Removed .toJSONString() from sugarpak.js. Please use .toISOString(). The .toISOString() function will return
an ISO 8601 string of the date that has been converted to it's UTC value.
The following example demonstrates passing a format to the .toString() function to return a string
whose date has NOT been converted to it's UTC value and does not include the wrapping double-quotes of .toISOString().
Example
new Date().toString("yyyy-MM-ddTHH:mm:ssZ");
11. Confirmed core.js and sugarpak.js modules still validate JSLint (http://www.jslint.com) 100% in whitespace strict mode.
--------------------
2008-04-04 [geoffrey.mcgill]
Revision #150
1. Fixed Parser.js bug where the parser was using the static month token to compare against the
abbreviatedMonthNames array in the CultureInfo file. This was causing problems when the
abbreviatedMonthNames strings were not en-US based.
Example
// CultureInfo = "de-DE.js"
Date.parse("mai"); // should return May 1st of current year, but was returning null
The fix required changing the following (approx line #525) in Parser.js.
// Old
this.month = ((s.length == 3) ? $D.getMonthNumberFromName(s) : (Number(s) - 1));
// New
this.month = (s.length == 3) ? "jan feb mar apr may jun jul aug sep oct nov dec".indexOf(s)/4 : Number(s) - 1;
2. Fixed bug in time.js inside the TimePeriod class. A prototype of TimeSpan was mistakingly being set
from within the TimePeriod class.
The following demonstrates using the TimePeriod class to get the difference between two dates.
Example
var future = new Date().add({months: 5, days: 4, hours: 3, minutes: 2, seconds: 1});
var now = new Date();
var tp = new TimePeriod(future, now);
console.log(tp.getYears());
console.log(tp.getMonths());
console.log(tp.getDays());
console.log(tp.getHours());
console.log(tp.getMinutes());
console.log(tp.getSeconds());
--------------------
2008-04-01 [geoffrey.mcgill]
1. Fixed bug where Date.nov().final().sunday() would return the second to last sunday.
The bug was in the function moveToNthOccurrence (core.js). If the final day of the month
matched the final day required, then the second-to-last instance of the day required
would be returned.
Example
// Old - Final day of month is a Sunday
Date.nov().final().sunday() // return 23-Nov-2008
// New
Date.nov().final().sunday() // return 30-Nov-2008
2. Added several tests to /trunk/test/core/ to test for this scenario.
--------------------
2008-03-27 [geoffrey.mcgill]
1. Fixed bug which caused the string "Jan 2008" to not be parsed correctly. The 'Day' value would be
set to "today's" Day. For example, if Today is the 27th day of the month, Date.parse("Jan 2008")
would return "27-Jan-2008", although "1-Jan-2008" was expected.
The bug was caused by a check to see if the value of this.month was existed within Parser.finish.
If a variable is set to the Number "0", JavaScript appears to treat that as null or undefined
even though the Number "0" is valid.
Required an explicit check for the Number "0" in addition to the variable existence check.
Example
// Old (line #727 in parser.js)
if (this.month && !this.day) {
// New (line #727 in parser.js)
if ((this.month || this.month === 0) && !this.day) {
2. Added about 100 new tests to /trunk/test/partial/ which test for vaiations on date strings
with no Day value and No Year-or-Month value. View online at http://www.datejs.com/test/partial/
--------------------
2008-03-24 [geoffrey.mcgill]
1. Fixed bug where a single digit minute or second value would not parse correctly.
See forum post http://tinyurl.com/3d8b57.
Made the following revision:
// Old
g.hms = _.cache(_.sequence([g.H, g.mm, g.ss], g.timePartDelimiter));
// New
g.hms = _.cache(_.sequence([g.H, g.m, g.s], g.timePartDelimiter));
2. Added a few tests to /trunk/test/time/ relating to above fix.
--------------------
2008-03-18 [geoffrey.mcgill]
1. Made small revision to .addDays() which should avoid addition/subtraction issues when
spanning over a Daylight Saving Time (Summer Time) change.
--------------------
2008-03-03 [geoffrey.mcgill]
1. Fixed .toString() bug where .toString would not return four characters if the year was less than 1000.
// Old
console.log(Date.today().set({year: 10}).toString("yyyy"); // "10"
// New
console.log(Date.today().set({year: 10}).toString("yyyy"); // "0010"
The fix also corrected the same issue with .toString("yy") if the year was less than 10.
// Old
console.log(Date.today().set({year: 5}).toString("yy"); // "5"
// New
console.log(Date.today().set({year: 5}).toString("yy"); // "05"
--------------------
2008-02-26 [geoffrey.mcgill]
1. Dan Yoder fixed bug with timeContext pattern where if a date included "april" or "august", the parser thought the 'a' was the beginning of a time part (as in am/pm).
"added a quick negative lookahead to the regexp to make sure the 'a' isn't followed by a 'u' or a 'p'."
// Old
timeContext: /^\s*(\:|a|p)/i
// New
timeContext: /^\s*(\:|a(?!u|p)|p)/i
2. Fixed bug in Parser.finish, which was causing "11 Aug 2007 7:15:00 am EDT" to fail.
--------------------
2008-02-21 [geoffrey.mcgill]
1. Fixed bug in .parseExact where if the month was January ('0') the Parser.finishExact function was resetting to the current month.
2. Added several new tests to /trunk/test/parseExact/.
--------------------
2008-02-18 [geoffrey.mcgill]
1. Added .toISOString() back to sugarpak.js. Still investigating to figure out why/how this function was removed at Build 130-131.
2. Fixed small bug in .is().weekday() where .weekday() was not returning 'this' if the .is() flag had not been set.
--------------------
2008-02-07 [geoffrey.mcgill]
1. Fixed bug in parser.js which prevented some strings from parsing when the 'day' of the date string was greater than the last day of the current month.
Example
// Today is 13-Feb-2008
Date.parse("30 Apr 2008"); //FAIL
Date strings which fall under this scenario should now parse correctly.
--------------------
2008-02-05 [geoffrey.mcgill]
1. Added .is().weekday() function to sugarpak.js.
The .weekday() function determines if the current date is a weekday.
The function must be preceded by the .is() function.
Example
Date.today().is().weekday(); // true|false
--------------------
2008-02-04 [geoffrey.mcgill]
1. Added .getOrdinal() tests to the new sugarpak (/trunk/test/sugarpak/) test package.
See http://www.datejs.com/test/sugarpak/index.html
--------------------
2008-01-02 [geoffrey.mcgill]
1. Added .toISOString() to sugarpak.js. Returns ISO 8601 formatted string of date.
2. Changed .toJSONString() to return string value wrapped in double-quotes ("") as per
JSON.org spec.
If you want an ISO/JSON date formatted string WITHOUT the double-quotes, please pass
a format to the .toString() function.
Example
new Date().toString("yyyy-MM-ddTHH:mm:ssZ");
3. Fixed bug where Date.parse("monday") was not returning correct year when the current
week overlapped the end of year.
4. Fixed bug in .parseExact() where day was being initialized to '1' if no day was present in the date string.
This was a problem when only parsing a Time.
5. New tests added to /test/parseExact/.
6. Found and fixed bug where if a string to be parsed was a digit with a trailing space.
Example
// Old
Date.parse("5 "); // returned current day at 5 AM. Wrong.
// New
Date.parse("5 "); // return 5th day of current month. Correct.
Just trimming whitespace before sending string into parser fixed the problem.
7. Added parser support for...
"3 years ago"
"7 hours ago"
--------------------
2007-12-27 [geoffrey.mcgill]
1. Modified the offset values of Date.CultureInfo.timezones.
2. Added <static> Date.compare(date1, date2).
Example
var date1 = Date.today();
var date2 = Date.today().add(1).day();
Date.compare(date1, date2); // returns -1
3. Added <static> Date.equals(date1, date2).
Example
var date1 = Date.today();
var date2 = Date.today().add(1).day();
Date.equals(date1, date2); // returns false
4. Fixed bug in Date.getDayNumberFromName() where it was not checking against the Date.CultureInfo.shortestDayNames array.
5. Removed <static> Date.getDayName(dayOfWeek). Please use Date.CultureInfo.dayNames[dayOfWeek]. Other options include:
Date.CultureInfo.dayNames[dayOfWeek]
Date.CultureInfo.abbreviatedDayNames[dayOfWeek]
Date.CultureInfo.shortestDayNames[dayOfWeek]
If you have a Date instance, please use .toString().
Example
Date.today().toString("dddd"); // "Thursday"
Date.today().toString("ddd"); // "Thu"
5. Removed <static> Date.getMonthName(month). Please use Date.CultureInfo.monthNames[month].
Other options include:
Date.CultureInfo.monthNames[month]
Date.CultureInfo.abbreviatedMonthNames[month]
If you have a Date instance, please use .toString().
Example
Date.today().toString("MMMM"); // "December"
Date.today().toString("MMM"); // "Dec"
6. Added Date.prototype.hasDaylightSavingTime().
Returns a boolean value indicating whether Daylight Saving Time is observed in the current time zone.
7. Added Date.prototype.isDaylightSavingTime().
Returns a boolean value indicating whether this Date instance is within the Daylight Saving Time range for the current time zone.
8. Verified core.js, sugarpak.js, and time.js are passing JSLint (http://www.jslint/) in "Strict whitespace" mode.
--------------------
2007-12-23 [geoffrey.mcgill]
1. Moved all minified files to the /build/ folder. Now all the original source files are
located in the /src/ folder, and all minified files are located in the /build/ folder.
2. Removed /trunk/doc/ folder.
3. Added CHANGELOG.txt file to /trunk/ folder.
4. Added README.txt file to /trunk/ folder.
5. Added LICENSE.txt file to /trunk/ folder.
6. Added TODO.txt file to /trunk/ folder.
--------------------