From c14bf8a0cada4748433c4a79946bc2fc6ca582b0 Mon Sep 17 00:00:00 2001 From: Michal Fiedorowicz Date: Fri, 13 May 2016 13:18:18 +0100 Subject: [PATCH] Added collection of user's offsetFromUTC on login --- README.md | 4 ++++ security/login.php | 8 +++++++- web/js/layout/main.js | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a4568a..e94a373 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ Installation Changelog --------- +## 1.1.0.3-alpha, May 13, 2016 + +- Added collection of user's offsetFromUTC on login + ## 1.1.0.2-alpha, May 2, 2016 - Updated styling and javascript for carousels and snippets diff --git a/security/login.php b/security/login.php index ec4d2a3..9a1bcc6 100644 --- a/security/login.php +++ b/security/login.php @@ -87,7 +87,7 @@ endField(); ?> - +
field($model, 'rememberMe')->checkbox(['label'=>'
'.$model->getAttributeLabel('rememberMe'). '', 'tabindex'=>"4"]) ?> @@ -113,3 +113,9 @@ 'baseAuthUrl' => ['/user/security/auth'] ]) ?>
+ +registerJs(" + $('[name=\"" . Html::getInputName($model, 'offsetFromUTC') . "\"]').val(mata.getEntryDateOffset()); +"); +?> diff --git a/web/js/layout/main.js b/web/js/layout/main.js index ce798f0..9ad1059 100644 --- a/web/js/layout/main.js +++ b/web/js/layout/main.js @@ -200,3 +200,13 @@ function addHeightToContainer(that) { $('#container').height(that.height() - $('.cd-header').outerHeight(true)); } } + +mata.getEntryDateOffset = function() { + var d = new Date(); + var retVal = d.getTimezoneOffset() * -1 / 60; + + if (retVal > 0 || retVal == 0) + retVal = "+" + retVal; + + return retVal; +}