testLoadDateFormat.js 661 B

12345678910111213141516171819
  1. /**
  2. * Created by Tony on 2017/7/13.
  3. */
  4. let test = require('tape');
  5. let fs = require("fs");
  6. test('std glj types test1', function(t){
  7. //console.log(__dirname.slice(0, __dirname.length - 12) + '/public/web/date_util.js');
  8. fs.readFile(__dirname.slice(0, __dirname.length - 12) + '/public/web/date_util.js', 'utf8', 'r', function (err, data) {
  9. eval(data);
  10. let dt = new Date();
  11. //dt.setMonth(dt.getMonth() + 3);
  12. t.equal(dt.Format('yyyy-M-dd'), "2017-7-13");
  13. t.equal(dt.Format('yyyy年M月dd日'), "2017年7月13日");
  14. t.equal(dt.Format('yyyy年M月20日'), "2017年7月20日");
  15. t.end();
  16. });
  17. });