Skip to content

Commit 1bd8426

Browse files
birth date -> open date
1 parent 9644617 commit 1bd8426

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

docs/customizations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Instead of the predefined 'Wish you a very happy birthday' text in the card, one
3232

3333
The card can be set to be visible only for a specific day. On other days, it will show a different page depending upon whether it is accessed before or after the specified date.
3434

35-
To set this, specify the date in `YYYY-MM-DD` format as `BIRTH_DATE` environment variable.
35+
To set this, specify the date in `YYYY-MM-DD` format as `OPEN_DATE` environment variable.
3636

3737
---
3838

docs/variables.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Following is the list of all the environment variables that are used in this pro
1111
NICKNAME
1212
HBD_MSG
1313
SCROLL_MSG
14-
BIRTH_DATE
14+
OPEN_DATE
1515
```
1616

1717
- The `NAME` and `NICKNAME` are self explainatory. `NICKNAME` is optional. If no nickname is provided, then value of name will be used in its place.
@@ -34,7 +34,7 @@ Following is the list of all the environment variables that are used in this pro
3434

3535
Check [Customizations](./customizations.md#the-scrolling-message) to know how to set up.
3636

37-
- `BIRTH_DATE` is an optional variable to specify the active date for the webpage. It the takes the date in `YYYY-MM-DD` format as value. Used to setup the Live Date feature. Check [Customizations](./customizations.md#live-only-for-a-specific-day) to know how to set up.
37+
- `OPEN_DATE` is an optional variable to specify the active date for the webpage. It the takes the date in `YYYY-MM-DD` format as value. Used to setup the Live Date feature. Check [Customizations](./customizations.md#live-only-for-a-specific-day) to know how to set up.
3838

3939
---
4040

example.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ HBD_MSG='May your soul rest in peace'
1919
SCROLL_MSG='sample-scroll.txt'
2020
## Name of the Scroll Message txt file
2121

22-
BIRTH_DATE='2022-08-09'
22+
OPEN_DATE='2022-08-09'
2323
## Active Date in YYYY-MM-DD format

src/js/ext/openDate.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import config from "../config.js";
2-
3-
// Script start here
4-
51
export const isBDay = function () {
6-
const startTime = new Date(config.birthDate + "T00:00").getTime();
2+
const startTime = new Date(process.env.OPEN_DATE + "T00:00").getTime();
73
const endTime = startTime + 24 * 60 * 60 * 1000;
84
const localTime = Date.now();
95
if (localTime < startTime) return "IS_EARLY";

src/js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { animate } from "./animation.js";
77

88
/******************************************************* SETUP ************************************************************/
99

10-
if (process.env.BIRTH_DATE) {
10+
if (process.env.OPEN_DATE) {
1111
const status = isBDay();
1212
if (status === "IS_EARLY") setPage(soon);
1313
if (status === "IS_LATE") setPage(late);

0 commit comments

Comments
 (0)