weechatRN

Weechat relay client for iOS using websockets https://github.com/mhoran/weechatRN
git clone http://git.hanabi.in/repos/weechatRN.git
Log | Files | Refs | README | LICENSE

commit e39a08dccaa0d47436a02206154bcc11855bbc0b
parent 634adda70e2f5c96ffe66bd10fbb247c78b03dbc
Author: Johan Lindskogen <johan.lindskogen@gmail.com>
Date:   Sun,  1 Apr 2018 16:53:10 +0200

Format date

Diffstat:
Mpackage.json | 1+
Asrc/lib/helpers/date-formatter.ts | 4++++
Msrc/usecase/buffers/ui/themes/Default.tsx | 3++-
Myarn.lock | 4++++
4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/package.json b/package.json @@ -8,6 +8,7 @@ }, "dependencies": { "@types/lodash": "^4.14.106", + "date-fns": "^1.29.0", "js-sha256": "^0.9.0", "lodash": "^4.17.5", "react": "^16.3.0-alpha.1", diff --git a/src/lib/helpers/date-formatter.ts b/src/lib/helpers/date-formatter.ts @@ -0,0 +1,4 @@ +import { format } from "date-fns"; + +export const formatDate = (date: string | number | Date) => + format(date, "ddd HH:mm:ss"); diff --git a/src/usecase/buffers/ui/themes/Default.tsx b/src/usecase/buffers/ui/themes/Default.tsx @@ -13,6 +13,7 @@ import { getHighlightedViewStyles, getHighlightedTextStyles } from "../../../../lib/weechat/color-formatter"; +import { formatDate } from "../../../../lib/helpers/date-formatter"; interface Props { line: WeechatLine; @@ -35,7 +36,7 @@ export default class BufferLine extends React.Component<Props> { <Text style={[styles.text, styles.meta, getHighlightedTextStyles(line)]} > - {String(line.date_printed)} + {formatDate(line.date_printed)} </Text> </View> <View diff --git a/yarn.lock b/yarn.lock @@ -1682,6 +1682,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.29.0: + version "1.29.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" + dateformat@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.2.0.tgz#4065e2013cf9fb916ddfd82efb506ad4c6769062"