sbd-npm 1.3.28 → 1.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.3.28",
3
+ "version": "1.3.30",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -1861,13 +1861,29 @@ const Util = {
1861
1861
  * @returns {number}
1862
1862
  */
1863
1863
  format_to_second: function (format) {
1864
- if (Util.regexp_date_yyyy_mm_dd(format) || Util.regexp_date_yyyy_mm_dd_hh_mm_ss(format)) {
1864
+ if (Util.regexp_date_yyyymmdd(format)) {
1865
+ format = format + "";
1866
+ let year = format.slice(0, 4);
1867
+ let month = format.slice(4, 6);
1868
+ let day = format.slice(6, 8);
1869
+ let date = new Date(year, month - 1, day);
1870
+ return (date.getTime() / 1000);
1871
+ } else if (Util.regexp_date_yyyy_mm_dd(format) || Util.regexp_date_yyyy_mm_dd_hh_mm_ss(format)) {
1865
1872
  let second = +new Date(format.replace(/-/g, '/'));
1866
1873
  return (second / 1000);
1867
1874
  }
1868
1875
  return 0;
1869
1876
  },
1870
1877
 
1878
+ /**
1879
+ * 正则匹配 20190910 这类时间格式
1880
+ * @param format
1881
+ */
1882
+ regexp_date_yyyymmdd: function (format) {
1883
+ format = format + "";
1884
+ return /^[1-9]\d{3}(0?[1-9]|1[0-2])(0?[1-9]|[1-2]\d|3[0-1])$/.test(format);
1885
+ },
1886
+
1871
1887
  /**
1872
1888
  * 正则匹配 2019-09-10 这类时间格式
1873
1889
  * @param format
@@ -2990,7 +3006,7 @@ const Util = {
2990
3006
  _html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
2991
3007
  _html.push('</div>');
2992
3008
  _html.push('</div>');
2993
- _html.push('<div class="form-group">');
3009
+ _html.push('<div class="form-group" style="margin-left: -15px;">');
2994
3010
  _html.push('<label for="', end_id, '"></label>');
2995
3011
  _html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
2996
3012
  _html.push('<input type="text" class="form-control has-feedback-left" id="', end_id, '" name="', end_id, '" title="结束时间" placeholder="结束时间" value="', end_date, '">');