sbd-npm 1.3.28 → 1.3.29

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 +17 -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.29",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -1861,13 +1861,28 @@ 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
+ let year = format.slice(0, 4);
1866
+ let month = format.slice(4, 6);
1867
+ let day = format.slice(6, 8);
1868
+ let date = new Date(year, month - 1, day);
1869
+ return (date.getTime() / 1000);
1870
+ } else if (Util.regexp_date_yyyy_mm_dd(format) || Util.regexp_date_yyyy_mm_dd_hh_mm_ss(format)) {
1865
1871
  let second = +new Date(format.replace(/-/g, '/'));
1866
1872
  return (second / 1000);
1867
1873
  }
1868
1874
  return 0;
1869
1875
  },
1870
1876
 
1877
+ /**
1878
+ * 正则匹配 20190910 这类时间格式
1879
+ * @param format
1880
+ */
1881
+ regexp_date_yyyymmdd: function (format) {
1882
+ format = format + "";
1883
+ return /^[1-9]\d{3}(0?[1-9]|1[0-2])(0?[1-9]|[1-2]\d|3[0-1])$/.test(format);
1884
+ },
1885
+
1871
1886
  /**
1872
1887
  * 正则匹配 2019-09-10 这类时间格式
1873
1888
  * @param format
@@ -2990,7 +3005,7 @@ const Util = {
2990
3005
  _html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
2991
3006
  _html.push('</div>');
2992
3007
  _html.push('</div>');
2993
- _html.push('<div class="form-group">');
3008
+ _html.push('<div class="form-group" style="margin-left: -15px;">');
2994
3009
  _html.push('<label for="', end_id, '"></label>');
2995
3010
  _html.push('<div class="col-md-6 col-sm-6 col-xs-12 form-group">');
2996
3011
  _html.push('<input type="text" class="form-control has-feedback-left" id="', end_id, '" name="', end_id, '" title="结束时间" placeholder="结束时间" value="', end_date, '">');