UNPKG

2.5 kBJavaScriptView Raw
1"use strict";
2/**
3 * This file is part of the @egodigital/egoose distribution.
4 * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
5 *
6 * @egodigital/egoose is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * @egodigital/egoose is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19const assert = require("assert");
20const mocha_1 = require("mocha");
21const moment = require("moment");
22const index_1 = require("../index");
23mocha_1.describe('#asLocal()', async function () {
24 mocha_1.describe('Date', function () {
25 mocha_1.it('utc => local', async function () {
26 const NOW = Date.UTC(1979, 9, 5, 23, 9, 19, 79);
27 const AS_LOCAL = index_1.asLocal(NOW);
28 assert.ok(AS_LOCAL.isLocal());
29 });
30 mocha_1.it('local => local', async function () {
31 const NOW = new Date(1979, 9, 5, 23, 9, 19, 79);
32 const AS_LOCAL = index_1.asLocal(NOW);
33 assert.ok(AS_LOCAL.isLocal());
34 });
35 });
36 mocha_1.describe('moment', function () {
37 mocha_1.it('utc => local', async function () {
38 const NOW = moment.utc();
39 const AS_LOCAL = index_1.asLocal(NOW);
40 assert.ok(AS_LOCAL.isLocal());
41 });
42 mocha_1.it('local => local', async function () {
43 const NOW = moment();
44 const AS_LOCAL = index_1.asLocal(NOW);
45 assert.ok(AS_LOCAL.isLocal());
46 });
47 });
48 mocha_1.describe('String', function () {
49 mocha_1.it('utc => local', async function () {
50 const NOW = '1979-09-05 23:09:19.079';
51 const AS_LOCAL = index_1.asLocal(NOW);
52 assert.ok(AS_LOCAL.isLocal());
53 });
54 mocha_1.it('local => local', async function () {
55 const NOW = '1979-09-05 23:09:19.079';
56 const AS_LOCAL = index_1.asLocal(NOW);
57 assert.ok(AS_LOCAL.isLocal());
58 });
59 });
60});
61//# sourceMappingURL=asLocal.js.map
\No newline at end of file