File tree Expand file tree Collapse file tree 11 files changed +22
-72
lines changed
ol-components/src/components Expand file tree Collapse file tree 11 files changed +22
-72
lines changed Original file line number Diff line number Diff line change 3
3
"version" : " 0.1.0" ,
4
4
"private" : true ,
5
5
"scripts" : {
6
- "dev" : " PORT=${PORT:-8062} TZ=UTC next dev" ,
6
+ "dev" : " PORT=${PORT:-8062} next dev" ,
7
7
"build" : " next build" ,
8
8
"build:no-lint" : " next build --no-lint" ,
9
- "start" : " TZ=UTC next start" ,
9
+ "start" : " next start" ,
10
10
"lint" : " next lint"
11
11
},
12
12
"dependencies" : {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import {
13
13
NewsEventsListFeedTypeEnum ,
14
14
} from "api/hooks/newsEvents"
15
15
import type { NewsFeedItem , EventFeedItem } from "api/v0"
16
- import { LocalDate } from "ol-utilities"
16
+ import { formatDate } from "ol-utilities"
17
17
import { RiArrowRightSLine } from "@remixicon/react"
18
18
import Link from "next/link"
19
19
@@ -196,7 +196,7 @@ const Story: React.FC<{ item: NewsFeedItem; mobile: boolean }> = ({
196
196
{ item . title }
197
197
</ Card . Title >
198
198
< Card . Footer >
199
- Published: < LocalDate date = { item . news_details ?. publish_date } />
199
+ Published: { formatDate ( item . news_details ?. publish_date ) }
200
200
</ Card . Footer >
201
201
</ StoryCard >
202
202
)
@@ -226,16 +226,16 @@ const NewsEventsSection: React.FC = () => {
226
226
< Card . Content >
227
227
< EventDate >
228
228
< EventDay >
229
- < LocalDate
230
- date = { ( item as EventFeedItem ) . event_details ?. event_datetime }
231
- format = "D"
232
- />
229
+ { formatDate (
230
+ ( item as EventFeedItem ) . event_details ?. event_datetime ,
231
+ "D" ,
232
+ ) }
233
233
</ EventDay >
234
234
< EventMonth >
235
- < LocalDate
236
- date = { ( item as EventFeedItem ) . event_details ?. event_datetime }
237
- format = "MMM"
238
- />
235
+ { formatDate (
236
+ ( item as EventFeedItem ) . event_details ?. event_datetime ,
237
+ "MMM" ,
238
+ ) }
239
239
</ EventMonth >
240
240
</ EventDate >
241
241
< Link href = { item . url } data-card-link >
Original file line number Diff line number Diff line change 9
9
} from "@remixicon/react"
10
10
import { LearningResource } from "api"
11
11
import {
12
- LocalDate ,
12
+ formatDate ,
13
13
getReadableResourceType ,
14
14
DEFAULT_RESOURCE_IMG ,
15
15
getLearningResourcePrices ,
@@ -149,8 +149,7 @@ const StartDate: React.FC<{ resource: LearningResource; size?: Size }> = ({
149
149
const format = size === "small" ? "MMM DD, YYYY" : "MMMM DD, YYYY"
150
150
const formatted = anytime
151
151
? "Anytime"
152
- : startDate && < LocalDate date = { startDate } format = { format } />
153
-
152
+ : startDate && formatDate ( startDate , format )
154
153
if ( ! formatted ) return null
155
154
156
155
const showLabel = size !== "small" || anytime
Original file line number Diff line number Diff line change 9
9
} from "@remixicon/react"
10
10
import { ResourceTypeEnum , LearningResource } from "api"
11
11
import {
12
- LocalDate ,
12
+ formatDate ,
13
13
getReadableResourceType ,
14
14
DEFAULT_RESOURCE_IMG ,
15
15
pluralize ,
@@ -151,7 +151,7 @@ export const StartDate: React.FC<{ resource: LearningResource }> = ({
151
151
const startDate = getResourceDate ( resource )
152
152
const formatted = anytime
153
153
? "Anytime"
154
- : startDate && < LocalDate date = { startDate } format = "MMMM DD, YYYY" />
154
+ : startDate && formatDate ( startDate , "MMMM DD, YYYY" )
155
155
if ( ! formatted ) return null
156
156
157
157
return (
Original file line number Diff line number Diff line change 8
8
getDisplayPrice ,
9
9
getRunPrices ,
10
10
showStartAnytime ,
11
- NoSSR ,
12
11
} from "ol-utilities"
13
12
14
13
const DifferingRuns = styled . div ( {
@@ -104,9 +103,7 @@ const DifferingRunsTable: React.FC<{ resource: LearningResource }> = ({
104
103
</ DifferingRunHeader >
105
104
{ resource . runs ?. map ( ( run , index ) => (
106
105
< DifferingRun key = { index } >
107
- < DateData >
108
- < NoSSR > { formatRunDate ( run , asTaughtIn ) } </ NoSSR >
109
- </ DateData >
106
+ < DateData > { formatRunDate ( run , asTaughtIn ) } </ DateData >
110
107
{ run . resource_prices && (
111
108
< PriceData >
112
109
< span > { getDisplayPrice ( getRunPrices ( run ) [ "course" ] ) } </ span >
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import {
24
24
formatRunDate ,
25
25
getLearningResourcePrices ,
26
26
showStartAnytime ,
27
- NoSSR ,
28
27
} from "ol-utilities"
29
28
import { theme } from "../ThemeProvider/ThemeProvider"
30
29
import DifferingRunsTable from "./DifferingRunsTable"
@@ -256,11 +255,7 @@ const INFO_ITEMS: InfoItemConfig = [
256
255
const totalDatesWithRuns =
257
256
resource . runs ?. filter ( ( run ) => run . start_date !== null ) . length || 0
258
257
if ( allRunsAreIdentical ( resource ) && totalDatesWithRuns > 0 ) {
259
- return (
260
- < NoSSR >
261
- < RunDates resource = { resource } />
262
- </ NoSSR >
263
- )
258
+ return < RunDates resource = { resource } />
264
259
} else return null
265
260
} ,
266
261
} ,
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { ButtonLink } from "../Button/Button"
7
7
import type { LearningResource , LearningResourceRun } from "api"
8
8
import { ResourceTypeEnum , PlatformEnum } from "api"
9
9
import {
10
- NoSSR ,
11
10
formatDate ,
12
11
capitalize ,
13
12
DEFAULT_RESOURCE_IMG ,
@@ -300,7 +299,7 @@ const ResourceDescription = ({ resource }: { resource?: LearningResource }) => {
300
299
return (
301
300
< Description
302
301
/**
303
- * Resource descriptions can contain HTML. They are sanitized on the
302
+ * Resource descriptions can contain HTML. They are santiized on the
304
303
* backend during ETL. This is safe to render.
305
304
*/
306
305
dangerouslySetInnerHTML = { { __html : resource . description || "" } }
@@ -385,7 +384,7 @@ const LearningResourceExpandedV1: React.FC<LearningResourceExpandedV1Props> = ({
385
384
. map ( ( run ) => {
386
385
return {
387
386
value : run . id . toString ( ) ,
388
- label : < NoSSR > { formatRunDate ( run , asTaughtIn ) } </ NoSSR > ,
387
+ label : formatRunDate ( run , asTaughtIn ) ,
389
388
}
390
389
} ) ?? [ ]
391
390
@@ -416,7 +415,7 @@ const LearningResourceExpandedV1: React.FC<LearningResourceExpandedV1Props> = ({
416
415
return (
417
416
< DateSingle >
418
417
< DateLabel > { label } </ DateLabel >
419
- < NoSSR > { formatted ?? "" } </ NoSSR >
418
+ { formatted ?? "" }
420
419
</ DateSingle >
421
420
)
422
421
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import moment from "moment"
2
2
3
- /* Instances must be wrapped in <NoSSR> to avoid SSR hydration mismatches.
4
- */
5
3
export const formatDate = (
6
4
/**
7
5
* Date string or date.
8
6
*/
9
7
date : string | Date ,
10
8
/**
11
- * A Moment.js format string. See https://momentjs.com/docs/#/displaying/format/
9
+ * A momentjs format string. See https://momentjs.com/docs/#/displaying/format/
12
10
*/
13
11
format = "MMM D, YYYY" ,
14
12
) => {
Original file line number Diff line number Diff line change 6
6
export * from "./styles"
7
7
8
8
export * from "./date/format"
9
- export * from "./date/LocalDate"
10
9
export * from "./learning-resources/learning-resources"
11
10
export * from "./learning-resources/pricing"
12
11
export * from "./strings/html"
@@ -15,4 +14,3 @@ export * from "./hooks"
15
14
export * from "./querystrings"
16
15
export * from "./lib"
17
16
export * from "./images/backgroundImages"
18
- export * from "./ssr/NoSSR"
You can’t perform that action at this time.
0 commit comments