1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-12 17:26:17 +00:00

Rename getLastUpdated() to formatDate()

This commit is contained in:
asmsuechan
2017-07-08 13:09:33 +09:00
parent 81e8a290f0
commit a7bd3f253f
3 changed files with 5 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ import moment from 'moment'
* @param {mixed}
* @return {string}
*/
export function getLastUpdated (date) {
export function formatDate (date) {
const m = moment(date)
if (!m.isValid()) {
throw Error('Invalid argument.')

View File

@@ -2,7 +2,7 @@
* @fileoverview Component for show updated date of the detail.
*/
import React, { PropTypes } from 'react'
import { getLastUpdated } from 'browser/lib/date-formatter'
import { formatDate } from 'browser/lib/date-formatter'
import CSSModules from 'browser/lib/CSSModules'
import styles from './LastUpdatedString.styl'
@@ -10,7 +10,7 @@ const LastUpdatedString = ({ date }) => {
let text = ''
try {
text = `Last updated at ${getLastUpdated(date)}`
text = `Last updated at ${formatDate(date)}`
} catch (e) {
text = ''
}

View File

@@ -2,11 +2,11 @@
* @fileoverview Unit test for browser/lib/date-formatter.js
*/
const test = require('ava')
const { getLastUpdated } = require('browser/lib/date-formatter')
const { formatDate } = require('browser/lib/date-formatter')
test(t => {
t.throws(
() => getLastUpdated('invalid argument'),
() => formatDate('invalid argument'),
'Invalid argument.'
)
})