Answers for "does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS"."

0

does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".

export function toDatetimeLocal(){
    const date = new Date(),
          ten = (i)=> ((i < 10 ? '0' : '') + i ),
    YYYY = date.getFullYear(),
    MTH = ten(date.getMonth() + 1),
    DAY = ten(date.getDate()),
    HH = ten(date.getHours()),
    MM = ten(date.getMinutes()),
    SS = ten(date.getSeconds())
    // MS = ten(date.getMilliseconds())

    return `${YYYY}-${MTH}-${DAY}T${HH}:${MM}:${SS}`


}
Posted by: Guest on April-23-2021

Code answers related to "does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS"."

Browse Popular Code Answers by Language