-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdate.js
More file actions
30 lines (30 loc) · 1015 Bytes
/
date.js
File metadata and controls
30 lines (30 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
define(["require", "exports", "util"], function (require, exports, util) {
/// <reference path="typings/com.ibm.domino.d.ts" />
"use amd";
function add(date) {
throw "Not implemented";
}
exports.add = add;
function format(date, format) {
var _a = [date.getDate(), date.getMonth() + 1, date.getFullYear()], d = _a[0], m = _a[1], y = _a[2];
return util.map(format.split(""), function (el) {
switch (el) {
case "d":
return d + "";
case "D":
return util.padleft(d, 2, "0");
case "m":
return m + "";
case "M":
return util.padleft(m, 2, "0");
case "y":
return y + "";
case "Y":
return util.padleft(y, 4, "0");
default:
return el + "";
}
}).join("");
}
exports.format = format;
});