Permalink
Browse files

gallery-2014.02.13-03-13 jafl gallery-datetime

  • Loading branch information...
Ezequiel
Ezequiel committed Feb 13, 2014
1 parent 3caf23b commit cbb6ea7db7c6849052d8ce7ab70d28b002ff1b6d
@@ -5,10 +5,10 @@
.yui3-skin-sam .yui3-calendar .yui3-datetime-partial
{
- background-image: url("http://yui.yahooapis.com/gallery-2013.06.26-23-09/gallery-datetime/assets/skins/sam/partial_day.gif");
+ background-image: url("http://yui.yahooapis.com/gallery-2014.02.13-03-13/gallery-datetime/assets/skins/sam/partial_day.gif");
}
.yui3-skin-sam .yui3-calendar .yui3-datetime-partial:hover
{
- background-image: url("http://yui.yahooapis.com/gallery-2013.06.26-23-09/gallery-datetime/assets/skins/sam/partial_day.gif");
+ background-image: url("http://yui.yahooapis.com/gallery-2014.02.13-03-13/gallery-datetime/assets/skins/sam/partial_day.gif");
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -883,7 +883,7 @@ Y.extend(DateTime, Y.Base,
Y.DateTime = DateTime;
-}, 'gallery-2013.06.26-23-09', {
+}, 'gallery-2014.02.13-03-13', {
"skinnable": "true",
"requires": [
"base",

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -883,7 +883,7 @@ Y.extend(DateTime, Y.Base,
Y.DateTime = DateTime;
-}, 'gallery-2013.06.26-23-09', {
+}, 'gallery-2014.02.13-03-13', {
"skinnable": "true",
"requires": [
"base",
@@ -3,6 +3,7 @@
<head>
<script src="/build/yui/yui-min.js"></script>
<script type="text/javascript" src="assets/tests.js"></script>
+<script type="text/javascript" src="../../../../build/gallery-datetime-range/gallery-datetime-range.js"></script>
</head>
<body class="yui3-skin-sam">
@@ -283,7 +283,7 @@ Y.DateTimeUtils =
var d = date.split(delimiter);
if (d.length != 3 || !Y.every(d, validInteger))
{
- throw Error('Unparseable date format.');
+ throw Error('Unparseable date format: ' + date);
}
return self.normalize(
@@ -332,9 +332,22 @@ Y.DateTimeUtils =
if (self.CLOCK_DISPLAY_TYPE == 12)
{
var s = self.TIME_FIELD_DELIMITER + pad2(time.minute) + ' ';
- return (time.hour > 12 ?
- (time.hour - 12) + s + self.PM_STRING :
- time.hour + s + self.AM_STRING);
+ if (time.hour === 0)
+ {
+ return '12' + s + self.AM_STRING;
+ }
+ else if (time.hour === 12)
+ {
+ return '12' + s + self.PM_STRING;
+ }
+ else if (time.hour > 12)
+ {
+ return (time.hour - 12) + s + self.PM_STRING;
+ }
+ else
+ {
+ return time.hour + s + self.AM_STRING;
+ }
}
else
{
@@ -365,27 +378,37 @@ Y.DateTimeUtils =
}
var offset = 0,
- ampm = false;
+ am = false,
+ pm = false;
if (time.indexOf(self.AM_STRING) > 0)
{
- ampm = true;
+ am = true;
time = Y.Lang.trim(time.replace(self.AM_STRING, ''));
}
else if (time.indexOf(self.PM_STRING) > 0)
{
- ampm = true;
+ pm = true;
time = Y.Lang.trim(time.replace(self.PM_STRING, ''));
offset = 12;
}
var t = time.split(self.TIME_FIELD_DELIMITER);
- if (t.length == 1 && ampm)
+ if (t.length == 1 && (am || pm))
{
t[1] = 0;
}
else if (t.length < 2 || 3 < t.length || !Y.every(t, validInteger))
{
- throw Error('Unparseable time format.');
+ throw Error('Unparseable time format: ' + time);
+ }
+
+ if (am && t[0] == '12')
+ {
+ t[0] = 0;
+ }
+ else if (pm && t[0] == '12')
+ {
+ offset = 0;
}
var result =
@@ -53,8 +53,6 @@ YUI.add('gallery-datetime-utils-tests', function(Y) {
Y.Assert.areSame('2012-6-11', Y.DateTimeUtils.formatDate('2012-6-11'));
Y.Assert.areSame('2012-06-11', Y.DateTimeUtils.formatDate(date));
Y.Assert.areSame('2012-06-11', Y.DateTimeUtils.formatDate({year:2012, month:6, day:11}));
-
- Y.Assert.areSame('275760-09-12', Y.DateTimeUtils.formatDate(8640000000000000));
},
testParseDate: function()
@@ -105,14 +103,18 @@ YUI.add('gallery-datetime-utils-tests', function(Y) {
Y.Assert.areSame('14:05', Y.DateTimeUtils.formatTime({hour:14, minute:5}));
Y.Assert.areSame('2:05', Y.DateTimeUtils.formatTime({hour:2, minute:5}));
Y.Assert.areSame('14:05', Y.DateTimeUtils.formatTime(date));
- Y.Assert.areSame('17:00', Y.DateTimeUtils.formatTime(8640000000000000));
Y.DateTimeUtils.CLOCK_DISPLAY_TYPE = 12;
Y.Assert.areSame('2:05 AM', Y.DateTimeUtils.formatTime({hour:2, minute:5}));
Y.Assert.areSame('2:05 PM', Y.DateTimeUtils.formatTime({hour:14, minute:5}));
Y.Assert.areSame('2:05 PM', Y.DateTimeUtils.formatTime(date));
+ Y.Assert.areSame('12:00 AM', Y.DateTimeUtils.formatTime({hour:0, minute:0}));
+ Y.Assert.areSame('12:02 AM', Y.DateTimeUtils.formatTime({hour:0, minute:2}));
+ Y.Assert.areSame('12:00 PM', Y.DateTimeUtils.formatTime({hour:12, minute:0}));
+ Y.Assert.areSame('12:05 PM', Y.DateTimeUtils.formatTime({hour:12, minute:5}));
+
Y.DateTimeUtils.CLOCK_DISPLAY_TYPE = 24;
},
@@ -142,6 +144,22 @@ YUI.add('gallery-datetime-utils-tests', function(Y) {
var t = Y.DateTimeUtils.parseTime('10AM');
Y.Assert.areSame(10, t.hour);
Y.Assert.areSame(0, t.minute);
+
+ t = Y.DateTimeUtils.parseTime('12AM');
+ Y.Assert.areSame(0, t.hour);
+ Y.Assert.areSame(0, t.minute);
+
+ t = Y.DateTimeUtils.parseTime('12:05AM');
+ Y.Assert.areSame(0, t.hour);
+ Y.Assert.areSame(5, t.minute);
+
+ t = Y.DateTimeUtils.parseTime('12PM');
+ Y.Assert.areSame(12, t.hour);
+ Y.Assert.areSame(0, t.minute);
+
+ t = Y.DateTimeUtils.parseTime('12:01PM');
+ Y.Assert.areSame(12, t.hour);
+ Y.Assert.areSame(1, t.minute);
},
testParseTimeInvalidValue: function()
@@ -3,6 +3,7 @@
<head>
<script src="/build/yui/yui-min.js"></script>
<script type="text/javascript" src="assets/tests.js"></script>
+<script type="text/javascript" src="../../../../build/gallery-datetime-utils/gallery-datetime-utils.js"></script>
</head>
<body class="yui3-skin-sam">
@@ -5,8 +5,8 @@
"errors": 0,
"ignored": 0,
"total": 0,
- "duration": 6,
+ "duration": 2,
"type": "report",
- "timestamp": "Wed 26 Jun 2013 03:59:36 PM PDT",
+ "timestamp": "Wed 12 Feb 2014 07:13:33 PM PST",
"consoleInfo": []
}
Oops, something went wrong.

0 comments on commit cbb6ea7

Please sign in to comment.