• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⏰ SSR-safe time element for Nuxt 3

Nuxt Time

npm version npm downloads Github Actions Codecov

SSR-safe time element for Nuxt 3

Features

  • SSR/SSG-safe rendering of any date/time
  • 💪 Prevents hydration mismatch on client
  • 🏁 Respects browser locale
  • Renders semantic <time> element

Installation

Install and add nuxt-time to your nuxt.config.

# Whichever matches your package manager
pnpm add -D nuxt-time
npm install -D nuxt-time
yarn add -D nuxt-time
export default defineNuxtConfig({
  modules: ['nuxt-time'],
})

Usage

To use, you can use the <NuxtTime> component anywhere in your app. It will render a spec-compliant <time> element.

It accepts datetime and locale (optional) properties, along with any property accepted by Intl.DateTimeFormat (see MDN reference). Note: you can provide a Date or number (e.g. Date.now()) via datetime and it will be rendered correctly as an ISO-formatted date.

<template>
  <!--
    Date.now() will safely respect the time on the server, not on the
    client. What's more, there will be no flash between server
    and client locale formatting.
  -->
  <NuxtTime :datetime="Date.now()" second="numeric" month="long" day="numeric" />
</template>

💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Stub module with pnpm dev:prepare
  • Run pnpm dev to start playground in development mode

License

Made with ❤️

Published under the MIT License.

More Repositories

1

nuxt-vitest

An vitest environment with support for testing code that needs a Nuxt runtime environment
TypeScript
370
star
2

typed-vuex

🏦 A typed store accessor for vanilla Vuex.
TypeScript
346
star
3

page-speed.dev

Vue
330
star
4

nuxt-zero-js

Remove all client-side JS from your Nuxt 3 app
TypeScript
191
star
5

unplugin-purge-polyfills

A tiny plugin to replace package imports with better native code.
TypeScript
190
star
6

nuxt-workers

SSR-safe, zero-config Web Workers integration for Nuxt.
TypeScript
186
star
7

sanity-typed-queries

A typed, zero-dependency schema generator and query builder for Sanity.
TypeScript
173
star
8

siroc

Zero-config build tooling for Node
TypeScript
149
star
9

vue-bind-once

A tiny, SSR-safe directive for binding random data to an element.
TypeScript
120
star
10

nuxt-full-static

Full static implementation for Nuxt 3
TypeScript
117
star
11

roe.dev

This is the code and content for my personal website, built in Nuxt.
TypeScript
113
star
12

n3rdle

Vue
90
star
13

goff

Sync GitHub issues offline into a local folder
TypeScript
70
star
14

rollup-plugin-pure

Annotate functions as pure for Rollup
TypeScript
64
star
15

nuxt-capo

`capo.js` implementation for Nuxt 3
TypeScript
59
star
16

vue-sanity

Sanity integration for Vue Composition API
TypeScript
55
star
17

nuxt-vercel-isr

A tiny demo to show off Nuxt's route rules integration with Vercel.
Vue
55
star
18

nuxt-web-bundle

Generate web bundles with Nuxt
TypeScript
51
star
19

nuxt-pre-hydrate

TypeScript
46
star
20

spooon

This is a tiny recipe app built in Nuxt for a live-coding session at Vue.js Nation 2024.
Vue
33
star
21

nuxt-timings-module

TypeScript
32
star
22

n3dium

This is a tiny, incomplete example for a paywalled content site built in Nuxt 3 for a live-coding session at Vue.js Global Summit 2022.
Vue
30
star
23

trellis-valet-driver

A driver for Laravel Valet that supports the default Trellis install.
PHP
26
star
24

postcss-capsize

TypeScript
25
star
25

agent-conf-2023

A demo of integrating React, Vite and Nitro for AgentConf 2023.
JavaScript
25
star
26

nuxt-vue3-module

TypeScript
22
star
27

nuxt-vscode-template

TypeScript
20
star
28

nuxt-deno

TypeScript
18
star
29

stream-vue

Vue component for Cloudflare Stream.
TypeScript
16
star
30

jetbrains-2023

Vue
15
star
31

firstcommit.is

TypeScript
14
star
32

nuxt-hanko

TypeScript
12
star
33

beasties

A library to inline your app's critical CSS and lazy-load the rest.
JavaScript
11
star
34

frontend-nation-2024

Tiny Nuxt multiplayer app built for a live-coding session at Frontend Nation 2024.
TypeScript
11
star
35

iodigital-2024

Vue
11
star
36

vuejslive

A demo of integrating Vue, Vite and Nitro for Vue.js Live London 2023.
JavaScript
10
star
37

domain-sync

A tiny script that migrates all my Gandi domains to use Cloudflare DNS.
TypeScript
10
star
38

nuxt-turnstile

Cloudflare Turnstile integration for Nuxt
TypeScript
9
star
39

template

JavaScript
9
star
40

future-of-coding-2024

Vue
9
star
41

vuejs-de

TypeScript
7
star
42

unmeta

Simple tools for interacting with HTML metadata tags
TypeScript
7
star
43

vercel-kv

TypeScript
7
star
44

botornot

Vue
7
star
45

nuxt-emoji-blast

TypeScript
6
star
46

renovate

5
star
47

native-esm

JavaScript
4
star
48

nuxt-typed-vuex-example

Vue
4
star
49

vuejs-athens-2024

Vue
4
star
50

flowers

Vue
4
star
51

_productivity_app

Bicep
4
star
52

nuxt-ui-vue

Vue
3
star
53

wearedevs

JavaScript
3
star
54

nuxt3-typed-routes

Vue
3
star
55

pigeon

Vue
3
star
56

danielroe

3
star
57

nuxt-nightly-action

TypeScript
3
star
58

gdg-portlaoise-2024

Vue
3
star
59

vue-subpath-conditions

TypeScript
3
star
60

nuxt-font-metrics

Font metric overrides to reduce CLS
TypeScript
2
star
61

nuxt-demo

TypeScript
2
star
62

partytown-example

TypeScript
2
star
63

viteconf

TypeScript
2
star
64

nuxt3-repros

TypeScript
2
star
65

vue3-pre-window-repro

JavaScript
2
star
66

digital-labin

JavaScript
2
star
67

nuxt-typed-vuex-vue-example

Vue
2
star
68

netlify-dynamic-builder

TypeScript
2
star
69

nuxt-rspack-starter

TypeScript
2
star
70

openflights-loader

TypeScript
1
star
71

building-better-with-nuxt-3

TypeScript
1
star
72

vuejs-berlin

Vue
1
star
73

.github

1
star
74

nuxt-fonts-demo

TypeScript
1
star
75

building-a-pwa-with-nuxt

JavaScript
1
star
76

sanity-module

1
star
77

critters-test

Vue
1
star
78

nuxi-upgrade-yarn3

TypeScript
1
star
79

nuxt-edge-preset

Vue
1
star
80

formkit-init

TypeScript
1
star
81

axios-types

Vue
1
star
82

nuxt-typed-vuex-ts-example

Vue
1
star
83

css-flash-repro

Vue
1
star