Type definitions for moment-strftime2 1.0 (#20873)

This commit is contained in:
Piotr Roszatycki
2017-10-24 10:53:15 -07:00
committed by Sheetal Nandi
parent 43f6f4ee29
commit 4b9fdd3722
4 changed files with 120 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
// Type definitions for moment-strftime2 1.0
// Project: https://github.com/ShogunPanda/moment-strftime2
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as _moment from 'moment';
declare module "moment" {
interface Moment {
strftime(pattern: string): string;
}
}
declare module "moment-timezone" {
interface Moment {
strftime(pattern: string): string;
}
}
// tslint:disable:export-just-namespace
// because separator has to be read-write
declare namespace MomentStrftime2 {
interface Modifiers {
"%": string;
A: string;
B: string;
C?: string;
D: string;
E?: string;
F: string;
G?: string;
H: string;
I: string;
J?: string;
K?: string;
L: string;
M: string;
N?: string;
O?: string;
P: string;
Q?: string;
R: string;
S: string;
T: string;
U?: string;
V: string;
W: string;
X?: string;
Y: string;
Z: string;
a: string;
b: string;
c?: string;
d: string;
e: string;
f?: string;
g: string;
h: string;
i?: string;
j: string;
k: string;
l: string;
m: string;
n?: string;
o?: string;
p: string;
q?: string;
r: string;
s: string;
t?: string;
u: string;
v?: string;
w: string;
x?: string;
y: string;
z: string;
}
let modifiers: Modifiers;
let separator: string;
function installTo(moment: object): void;
}
export = MomentStrftime2;
@@ -0,0 +1,8 @@
import moment = require("moment-timezone");
import strftime2 = require("moment-strftime2");
strftime2.installTo(moment);
moment("2016-10-10 12:34:56.135 +02:00").strftime("%d %o #d #o"); // "10 %o #d #o"
strftime2.separator = "$";
strftime2.modifiers.o = "DD";
moment("2016-10-10 12:34:56.135 +02:00").strftime("%d %o #d #o"); // "%d %o 10 10"
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"moment-strftime2-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }