searchSubtractFormatDateHelper to native as moment.js not needed

This commit is contained in:
djmaze 2020-07-31 16:45:43 +02:00
parent 45fa12be42
commit 327e6f65cd
3 changed files with 10 additions and 19 deletions

View file

@ -71,21 +71,21 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
|js/* |1.14.0 |native |gzip 1.14 |gzip |
|----------- |--------: |--------: |--------: |--------: |
|admin.js |2.130.942 |1.221.247 | 485.481 | 299.073 |
|app.js |4.184.455 |2.984.765 | 932.725 | 697.869 |
|admin.js |2.130.942 |1.220.345 | 485.481 | 299.073 |
|app.js |4.184.455 |2.984.455 | 932.725 | 697.869 |
|boot.js | 671.522 | 94.230 | 169.502 | 28.386 |
|libs.js | 647.614 | 507.015 | 194.728 | 153.918 |
|polyfills.js | 325.834 | 0 | 71.825 | 0 |
|TOTAL js |7.960.367 |4.807.257 |1.854.261 |1.179.246 |
|TOTAL js |7.960.367 |4.806.045 |1.854.261 |1.179.246 |
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|--------------- |--------: |--------: |--------: |--------: |
|admin.min.js | 252.147 | 157.523 | 73.657 | 45.136 |
|app.min.js | 511.202 | 389.339 |140.462 |102.945 |
|admin.min.js | 252.147 | 157.387 | 73.657 | 45.136 |
|app.min.js | 511.202 | 389.269 |140.462 |102.945 |
|boot.min.js | 66.007 | 11.575 | 22.567 | 4.461 |
|libs.min.js | 572.545 | 464.161 |176.720 |143.916 |
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|TOTAL js/min |1.434.353 |1.022.598 |424.718 |296.458 |
|TOTAL js/min |1.434.353 |1.022.392 |424.718 |296.458 |
411.755 bytes (128.260 gzip) is not much, but it feels faster.

View file

@ -39,17 +39,6 @@ export function momentNowUnix() {
return _momentNow || 0;
}
/**
* @param {number} date
* @returns {string}
*/
export function searchSubtractFormatDateHelper(date) {
return momentNow()
.clone()
.subtract(date, 'days')
.format('YYYY.MM.DD');
}
/**
* @param {Object} m
* @returns {string}

View file

@ -2,7 +2,6 @@ import ko from 'ko';
import { trim } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { searchSubtractFormatDateHelper } from 'Common/Momentor';
import MessageStore from 'Stores/User/Message';
@ -120,7 +119,10 @@ class AdvancedSearchPopupView extends AbstractViewNext {
}
if (-1 < this.selectedDateValue()) {
result.push('date:' + searchSubtractFormatDateHelper(this.selectedDateValue()) + '/');
let d = new Date(), pad2 = v => 10 > v ? '0' + v : v;
d.setDate(d.getDate() - this.selectedDateValue());
// d.format('Y.m.d');
result.push('date:' + d.getFullYear()+'.'+pad2(d.getMonth()+1)+'.'+pad2(d.getDate()) + '/');
}
if (text) {