mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Merge pull request #1221 from cosmos/padded-implementation
Simplify padded implementation
This commit is contained in:
commit
b9bf5cc76c
@ -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…
x
Reference in New Issue
Block a user