Skip to content

Commit eb8f3b8

Browse files
committed
Parse date only from filter value to kill timezone issues
Don't double refresh on filter reset Don't kneecap js handlers on buttons if we don't have to for the confirmMessage
1 parent 67ca6f7 commit eb8f3b8

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

Build/CommonAssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
//
1616
// You can specify all the values or you can default the Revision and Build Numbers
1717
// by using the '*' as shown below:
18-
[assembly: AssemblyVersion("1.6.6")]
19-
[assembly: AssemblyFileVersion("1.6.6")]
18+
[assembly: AssemblyVersion("1.6.8")]
19+
[assembly: AssemblyFileVersion("1.6.8")]
2020
//[assembly: AssemblyInformationalVersion("1.4.5-editlyalpha2")]

Griddly/Scripts/griddly.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,26 @@
940940
switch (datatype)
941941
{
942942
case "Date":
943-
var date = new Date(value);
943+
var date;
944+
var pos;
945+
946+
if (typeof (value) === "string" && (pos = value.indexOf("T")) != -1)
947+
{
948+
value = value.substr(0, pos);
949+
950+
// Strip time, we only want date
951+
var parts = value.split('-');
952+
953+
// new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]])
954+
date = new Date(parts[0], parts[1] - 1, parts[2]); // Note: months are 0-based
955+
}
956+
else
957+
date = new Date(value);
958+
959+
date.setHours(0, 0, 0, 0);
960+
944961
value = date.toLocaleDateString();
962+
945963
break;
946964
case "Currency":
947965
value = parseFloat(value).toFixed(2);
@@ -986,7 +1004,7 @@
9861004
this.$element.find("form .transient").remove();
9871005
this.$element.find("form")[0].reset();
9881006

989-
this.setFilterValues(this.options.filterDefaults);
1007+
this.setFilterValues(this.options.filterDefaults, null, true);
9901008

9911009
// clear any none's that were inadvertently reset
9921010
this.$element.find(".griddly-filters-form [data-griddly-filter-isnoneall=true] [multiple] option[value=]").prop("selected", false);
@@ -1442,7 +1460,7 @@
14421460
return this.ajax(url, selection, button, griddly);
14431461
}
14441462
}
1445-
else if (!toggle && url)
1463+
else if (!toggle && url && typeof confirmMessage !== "undefined")
14461464
window.location = url;
14471465

14481466
if (onclick)

0 commit comments

Comments
 (0)