annotate client/src/lib/date.js @ 2282:2e40909a975d

clean searchbar when context is changed
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 15 Feb 2019 11:55:56 +0100
parents 4dbed34f8738
children 0f3b0937e7c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1525
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
2 * without warranty, see README.md and license for details.
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
3 *
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
6 *
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
7 * Copyright (C) 2018 by via donau
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
9 * Software engineering by Intevation GmbH
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
10 *
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
11 * Author(s):
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
12 * Thomas Junk <thomas.junk@intevation.de>
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
13 */
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
14
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
15 import locale2 from "locale2";
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
16
1522
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 const formatSurveyDate = current => {
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 return current
1525
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
19 ? new Date(current).toLocaleDateString(locale2, {
1522
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 day: "2-digit",
1525
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
21 month: "2-digit",
4dbed34f8738 date localized according to browserlanguage
Thomas Junk <thomas.junk@intevation.de>
parents: 1522
diff changeset
22 year: "numeric"
1522
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 })
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 : "";
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 };
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26
b34caa449c01 add date,js
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 export { formatSurveyDate };