aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-10-28 07:46:36 -0400
committerCash Costello <cash.costello@gmail.com>2011-10-28 07:46:36 -0400
commitfeefadb125770c0a513735ba7b3d6bea78c77d3b (patch)
treedce12d9edc21578605da76e2707031fc3fff6ff3
parent3c1cd53a399b32ee5bae7f095b3686fa62310ef1 (diff)
downloadelgg-feefadb125770c0a513735ba7b3d6bea78c77d3b.tar.gz
elgg-feefadb125770c0a513735ba7b3d6bea78c77d3b.tar.bz2
Fixes #4012 when using a timestamp with input/date, return UTC time rather than local time
-rw-r--r--js/lib/ui.js4
-rw-r--r--views/default/input/date.php1
2 files changed, 3 insertions, 2 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 166ca16bc..6cc1bc78a 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -267,8 +267,8 @@ elgg.ui.initDatePicker = function() {
onSelect: function(dateText) {
if ($(this).is('.elgg-input-timestamp')) {
// convert to unix timestamp
- var date = $.datepicker.parseDate('yy-mm-dd', dateText);
- var timestamp = $.datepicker.formatDate('@', date);
+ var dateParts = dateText.split("-");
+ var timestamp = Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2]);
timestamp = timestamp / 1000;
var id = $(this).attr('id');
diff --git a/views/default/input/date.php b/views/default/input/date.php
index 35a951a0b..ceeb2105c 100644
--- a/views/default/input/date.php
+++ b/views/default/input/date.php
@@ -44,6 +44,7 @@ if ($timestamp) {
$vars['class'] = "{$vars['class']} elgg-input-timestamp";
$vars['id'] = $vars['name'];
unset($vars['name']);
+ unset($vars['internalname']);
}
// convert timestamps to text for display