Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const express = require('express');
const fileUpload = require('express-fileupload');
const Firestore = require('@google-cloud/firestore');
const Promise = require("bluebird");
const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const path = require('path');
const dayjs = require('dayjs');
const relativeTime = require('dayjs/plugin/relativeTime')
dayjs.extend(relativeTime)
const app = express();
app.use(express.static('public'));
app.use(fileUpload({
limits: { fileSize: 10 * 1024 * 1024 },
useTempFiles : true,
tempFileDir : '/tmp/'
}))
app.post('/api/pictures', async (req, res) => {
if (!req.files || Object.keys(req.files).length === 0) {
console.log("No file uploaded");
return res.status(400).send('No file was uploaded.');
}
console.log(`Receiving file ${JSON.stringify(req.files.picture)}`);
import React from 'react'
import { Tooltip } from 'antd'
import dayjs from 'dayjs'
import { withTranslation } from 'react-i18next'
dayjs.extend(require('dayjs/plugin/localizedFormat'))
@withTranslation() // Re-render when language changes
class Long extends React.PureComponent {
render() {
const { unixTimeStampMs, ...rest } = this.props
return (
{format(unixTimeStampMs)}
)
}
}
export function format(unixTimeStampMs) {
return dayjs(unixTimeStampMs).format('ll LTS')
}
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import relative from 'dayjs/plugin/relativeTime';
dayjs.extend(utc);
dayjs.extend(relative);
function dateFromString(str) {
const isUTC = /Z$/.test(str);
const ints = str.split(/[^0-9]/).map(s => parseInt(s, 10));
if (isUTC) {
const ms = Date.UTC(
ints[0],
ints[1] - 1 || 0,
ints[2] || 1,
ints[3] || 0,
ints[4] || 0,
ints[5] || 0,
ints[6] || 0
);
export const setupDayjs = (): void => {
dayjs.extend(relativeTime);
dayjs.extend(isBetween);
dayjs.extend(advancedFormat);
};
import defaultDayjs from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import advancedFormat from "dayjs/plugin/advancedFormat";
import { IUtils } from "@date-io/core/IUtils";
defaultDayjs.extend(customParseFormat);
defaultDayjs.extend(advancedFormat);
interface Opts {
locale?: string;
/** Make sure that your dayjs instance extends customParseFormat and advancedFormat */
instance?: typeof defaultDayjs;
/** @deprecated */
dayjs?: typeof defaultDayjs;
}
type Dayjs = defaultDayjs.Dayjs;
type Constructor = (...args: Parameters) => Dayjs;
const withLocale = (dayjs: typeof defaultDayjs, locale?: string): Constructor =>
!locale ? dayjs : (...args) => dayjs(...args).locale(locale);
import theme from '../../../config/theme';
import {
Consumer as FetchConsumer,
ContextProps as FetchContextProps,
} from '../../../containers/Fetch';
import {
Consumer as AuthConsumer,
ContextProps as AuthContextProps,
} from '../../../containers/Auth';
import {
Consumer as ItemsConsumer,
ContextProps as ItemsContextProps,
} from '../../../containers/Items';
import Page from './Page';
dayjs.extend(advancedFormat);
type Props = {
navigation: NavigationScreenProp;
};
export default class extends Component {
static navigationOptions = () => {
return {
title: 'マイページ',
headerBackTitle: '',
headerTitleStyle: {
color: theme().mode.header.text,
},
headerTintColor: theme().mode.header.text,
headerStyle: {
backgroundColor: theme().mode.header.backgroundColor,
import 'dayjs/locale/zh'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.extend(relativeTime)
export function dayComparator(a: string, b: string) {
const dayA = dayjs(a)
const dayB = dayjs(b)
if (dayB.isAfter(dayA)) {
return 1
}
if (dayB.isBefore(dayA)) {
return -1
}
return 0
}