Skip to content

Commit

Permalink
Added collection of user's offsetFromUTC on login
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Fiedorowicz committed May 13, 2016
1 parent f12b9ce commit c14bf8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion security/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</span>
<!-- <div class="help-block"></div> -->
<?= $form->endField(); ?>

<input type="hidden" name="<?= Html::getInputName($model, 'offsetFromUTC'); ?>" />
<div class="row" id="submit-remember-me-container">
<div class="five columns">
<?= $form->field($model, 'rememberMe')->checkbox(['label'=>'<div></div><span>'.$model->getAttributeLabel('rememberMe'). '</span>', 'tabindex'=>"4"]) ?>
Expand All @@ -113,3 +113,9 @@
'baseAuthUrl' => ['/user/security/auth']
]) ?>
</div>

<?php
$this->registerJs("
$('[name=\"" . Html::getInputName($model, 'offsetFromUTC') . "\"]').val(mata.getEntryDateOffset());
");
?>
10 changes: 10 additions & 0 deletions web/js/layout/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit c14bf8a

Please sign in to comment.