Simplify padded implementation
This commit is contained in:
parent
70e0549ed7
commit
64ee51db5b
@ -4,8 +4,7 @@ const rfc3339Matcher =
|
||||
/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?((?:[+-]\d{2}:\d{2})|Z)$/;
|
||||
|
||||
function padded(integer: number, length = 2): string {
|
||||
const filled = "00000" + integer.toString();
|
||||
return filled.substring(filled.length - length);
|
||||
return integer.toString().padStart(length, "0");
|
||||
}
|
||||
|
||||
export function fromRfc3339(str: string): Date {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user