var date ="03/05/2013";
var localDate = date.split("/").reverse().join("-");
var localTime = "20:41"
var UTCDateTime = localDate+ "T" + localTime +":00.000Z";
localDateTime = new Date(UTCDateTime)
var options = { hour12: false, day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute:'2-digit' };
console.log("Date:>>"+localDateTime.toLocaleString('en', options));Run Code Online (Sandbox Code Playgroud)
如何在日期后删除逗号 Date:>>05/03/2013 21:41
我已经实现了在 keyup 事件上自动扩展 textarea 高度的逻辑。但是,一旦值通过敲除自定义绑定绑定到 textarea,我希望 textarea 也初始化其高度。任何解决方案?(仅使用 KnockoutJS,不使用 jQuery 或任何其他库。)
我是 redux 的新手,请问这是在以下代码中执行 redux 的正确方法吗?当调用 action 来执行 currentTime 时,这是一个 reducer 方法。
import { combineReducers } from 'redux';
import { UPDATE_TIME } from './actions';
import { Map } from 'immutable';
const initialState = Map({update:false, currentTime: ""});
function currentTime(state = initialState, action) {
switch (action.type) {
case UPDATE_TIME:
return {...state, update: true, currentTime: action.time };
default:
return state;
}
}
const currentTimeReducer = combineReducers({
currentTime
});
export default currentTimeReducer
Run Code Online (Sandbox Code Playgroud) javascript ×3
frontend ×1
html ×1
immutable.js ×1
jquery ×1
knockout.js ×1
locale ×1
reactjs ×1
redux ×1