Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update range #13

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update range
What do you think about my range? This range work fine with `'timePicker' => true,` also, your not.
And http:https://momentjs.com/docs/#/manipulating/subtract/ 
```
moment().subtract('seconds', 1); // Deprecated in 2.8.0
moment().subtract(1, 'seconds');
```
  • Loading branch information
githubjeka committed Nov 21, 2014
commit 136bbe71ee7165b4d54ab2edaa9edf0bf302e20b
12 changes: 6 additions & 6 deletions DateRangePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ protected function initRange()
if ($this->presetDropdown) {
$this->initRangeExpr = true;
$this->pluginOptions['ranges'] = [
Yii::t('kvdrp', "Today") => ["moment()", "moment()"],
Yii::t('kvdrp', "Yesterday") => ["moment().subtract('days', 1)", "moment().subtract('days', 1)"],
Yii::t('kvdrp', "Last {n} Days", ['n' => 7]) => ["moment().subtract('days', 6)", "moment()"],
Yii::t('kvdrp', "Last {n} Days", ['n' => 30]) => ["moment().subtract('days', 29)", "moment()"],
Yii::t('kvdrp', "Today") => ["moment().startOf('day')", "moment()"],
Yii::t('kvdrp', "Yesterday") => ["moment().startOf('day').subtract(1,'days')", "moment().endOf('day').subtract(1,'days')"],
Yii::t('kvdrp', "Last {n} Days", ['n' => 7]) => ["moment().startOf('day').subtract(6, 'days')", "moment()"],
Yii::t('kvdrp', "Last {n} Days", ['n' => 30]) => ["moment().startOf('day').subtract(29, 'days')", "moment()"],
Yii::t('kvdrp', "This Month") => ["moment().startOf('month')", "moment().endOf('month')"],
Yii::t('kvdrp', "Last Month") => ["moment().subtract('month', 1).startOf('month')", "moment().subtract('month', 1).endOf('month')"],
Yii::t('kvdrp', "Last Month") => ["moment().subtract(1, 'month').startOf('month')", "moment().subtract(1, 'month').endOf('month')"],
];
$this->pluginOptions['startDate'] = new JsExpression("moment().subtract('days', 29)");
$this->pluginOptions['startDate'] = new JsExpression("moment().subtract(1, 'month')");
$this->pluginOptions['endDate'] = new JsExpression("moment()");
}
if (!$this->initRangeExpr || empty($this->pluginOptions['ranges']) || !is_array($this->pluginOptions['ranges'])) {
Expand Down