Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.16...v2.0.0) - 2026-04-XX

- Remove `moment-timezone` dependency (replace with built-in `Temporal`) **Possible breaking change.** Requires Node.js v22.21.1 or higher.

## [1.0.16](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.15...v1.0.16) - 2026-04-04

- Update dependencies
- Temporarily add `picomatch` and `flatted` devdependencies to specify patched versions

## [1.0.16](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.15...v1.0.16) - 2026-04-04

- Update dependencies
Expand All @@ -26,11 +35,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [1.0.12](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.11...v1.0.12) - 2024-07-31

- BUG FIX: Fix missing time of quake in certain circumstances
- **BUG FIX**: Fix missing time of quake in certain circumstances

## [1.0.11](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.10...v1.0.11) - 2024-07-29

- BUG FIX: Fix `=== 0` logic error
- **BUG FIX**: Fix `=== 0` logic error
- Update dependencies

## [1.0.10](https://github.com/dathbe/MMM-EarthquakeAlerts/compare/v1.0.9...v1.0.10) - 2024-07-05
Expand Down
1 change: 0 additions & 1 deletion MMM-EarthquakeAlerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

Module.register('MMM-EarthquakeAlerts', {

// Default config.
defaults: {
locations: [
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

`MMM-EarthquakeAlerts` is a module for [MagicMirror²](https://github.com/MagicMirrorOrg/MagicMirror). It posts alert messages to your MagicMirror regarding recent earthquakes based on USGS data.

**Version 2.0.0 relies on the built-in `Temporal` API instead of the `moment-timezone` external dependency. This requires Node.js v22.21.1 or higher.** This version of Node.js is already a requirement for MagicMirror² v2.34.0 and higher, so if you are already running the latest version of MagicMirror², the module should work without issue. For that reason, v2.0.0 has set the minimum required MagicMirror² to v2.34.0.

![Example Screenshot](screenshot.png)

The module is set up to show:
Expand All @@ -28,7 +30,6 @@ npm install --omit=dev

Dependencies:
* [geolib](https://www.npmjs.com/package/geolib)
* [moment-timezone](https://www.npmjs.com/package/moment-timezone)

## Updating

Expand Down
5 changes: 3 additions & 2 deletions node_helper.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const Log = require('logger')
const NodeHelper = require('node_helper')
const moment = require('moment-timezone')
const geolib = require('geolib')

module.exports = NodeHelper.create({
requiresVersion: '2.34.0',

start: function () {
Log.log('Starting node_helper for: ' + this.name)
},

async getData(payload) {
// Fetch earthquake data for the last day (with at least magnitude1 magnitude)
try {
const url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=' + moment().tz('America/New_York').subtract(1, 'day').format() + '&minmagnitude=' + payload.magnitude1
const url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=' + Temporal.Now.zonedDateTimeISO('America/New_York').subtract({ days: 1 }).toString({ fractionalSecondDigits: 0, timeZoneName: 'never' }) + '&minmagnitude=' + payload.magnitude1
const response = await fetch(url)
Log.debug(`[MMM-EarthquakeAlerts] ${url} fetched`)
if (!response.ok) {
Expand Down
88 changes: 33 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmm-earthquakealerts",
"version": "1.0.0",
"version": "2.0.0",
"type": "commonjs",
"description": "A MagicMirror² module to display alerts for earthquakes near a chosen location.",
"repository": {
Expand All @@ -24,14 +24,13 @@
},
"license": "MIT",
"dependencies": {
"geolib": "^3.3.14",
"moment-timezone": "^0.6.1"
"geolib": "^3.3.14"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@stylistic/eslint-plugin": "^5.10.0",
"eslint": "^10.2.0",
"globals": "^17.4.0",
"eslint": "^10.4.0",
"globals": "^17.6.0",
"picomatch": "^4.0.4",
"flatted": "^3.4.2"
}
Expand Down
Loading