ant design使用日期控制項涉及的日期格式問題

2021-10-01 10:10:09 字數 2140 閱讀 8865

var moment = require('moment');

import moment from 'moment';

// 獲取當前年月日

const nowdate=moment().format('yyyy-mm-dd'); 2021-01-01

// 獲取當前時間的時間戳

const nowtime=new date().gettime();

// 將當前時間戳轉化為時間

const nowvalue=moment(nowtime).format('yyyy-mm-dd hh:mm:ss');

// 將當前時間轉化為時間戳

const nowtime1=moment(nowdate).valueof();

console.log("001===>>>  ",moment().format('yyyy-mm-dd hh:mm:ss'));                        //當前時間

console.log("002===>>>  ",moment().add(-1,'year').format('yyyy-mm-dd hh:mm:ss'));         //當前時間  前一年

console.log("003===>>>  ",moment().add(-1,'month').format('yyyy-mm-dd hh:mm:ss'));        //當前時間  前一月

console.log("004===>>>  ",moment().add(-1,'week').format('yyyy-mm-dd hh:mm:ss'));         //當前時間  前一周

console.log("005===>>>  ",moment().add(-1,'days').format('yyyy-mm-dd hh:mm:ss'));         //當前時間  前一天

console.log("006===>>>  ",moment().add(-1,'hour').format('yyyy-mm-dd hh:mm:ss'));         //當前時間  前一小時

console.log("007===>>>  ",moment().add(-1,'minute').format('yyyy-mm-dd hh:mm:ss'));       //當前時間  前一分鐘

console.log("008===>>>  ",moment().add(-1,'second').format('yyyy-mm-dd hh:mm:ss'));       //當前時間  前一秒

console.log("009===>>>  ",moment().utc().format("yyyy-mm-dd hh:mm:ss"));                  //當前時間  utc格式化

//001===>>>   2016-06-28 14:45:02

//002===>>>   2015-06-28 14:45:02

//003===>>>   2016-05-28 14:45:02

//004===>>>   2016-06-21 14:45:02

//005===>>>   2016-06-27 14:45:02

//006===>>>   2016-06-28 13:45:02

//007===>>>   2016-06-28 14:44:02

//008===>>>   2016-06-28 14:45:01

//009===>>>   2016-06-28 06:45:02

function filterqueryobj(obj, dateformatone, dateformattwo) ;

(object.keys(obj) || {}).foreach(key => else if (moment.ismoment(obj[key])) else if (typeof obj[key] === 'string') else if (_.isarray(obj[key]) && obj[key].length === 0) else

}});

return searchvalue;

}

// 去掉空格

function trim(str)

ant design日期控制項使用 僅月份

總體效果 展開後 選值後 部分 1 引入 import from antd 2 主體部分 export default class personinfo extends component render datepicker return 函式 日期面板時間值改變事件 workhandlepanel...

ant Design 使用記錄

此時使用的是antd3.版本 switch等元件 更改值後 需要resetfields key 的方式 更改為initialvalue狀態 以防再次渲染 無法觸發initialvalue的值 一般是適用於 一點觸發多點修改後 有些修改了一次的值 無法再次觸發initialvalue select 元...

AntDesign 長列表的使用

由於資料量比較大,載入時不一次性載入全部資料,而是通過引數page size載入數量 current page當前頁兩個引數查詢資料,實現滑動載入 classname key ref datasource 資料 renderfooter div renderrow 子元件樣式 rendersepar...