@lvce-editor/about-view 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225,109 +225,114 @@ const inSomeYears = years => {
225
225
  });
226
226
  };
227
227
 
228
- // based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
229
228
  const minute = 60;
230
229
  const hour = minute * 60;
231
230
  const day = hour * 24;
232
231
  const week = day * 7;
233
232
  const month = day * 30;
234
233
  const year = day * 365;
235
- const formatDatePast = seconds => {
234
+
235
+ // based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
236
+ const formatDateFuture = seconds => {
236
237
  if (seconds < minute) {
237
238
  if (seconds === 1) {
238
- return oneSecondAgo();
239
+ return inOneSecond();
239
240
  }
240
- return someSecondsAgo(seconds);
241
+ return inSomeSeconds(seconds);
241
242
  }
242
243
  if (seconds < hour) {
243
244
  const minutes = Math.floor(seconds / minute);
244
245
  if (minutes === 1) {
245
- return oneMinuteAgo();
246
+ return inOneMinute();
246
247
  }
247
- return someMinutesAgo(minutes);
248
+ return inSomeMinutes(minutes);
248
249
  }
249
250
  if (seconds < day) {
250
251
  const days = Math.floor(seconds / hour);
251
252
  if (days === 1) {
252
- return oneHourAgo();
253
+ return inOneHour();
253
254
  }
254
- return someHoursAgo(days);
255
+ return inSomeHours(days);
255
256
  }
256
257
  if (seconds < week) {
257
258
  const days = Math.floor(seconds / day);
258
259
  if (days === 1) {
259
- return oneDayAgo();
260
+ return inOneDay();
260
261
  }
261
- return someDaysAgo(days);
262
+ return inSomeDays(days);
262
263
  }
263
264
  if (seconds < month) {
264
265
  const weeks = Math.floor(seconds / week);
265
266
  if (weeks === 1) {
266
- return oneWeekAgo();
267
+ return inOneWeek();
267
268
  }
268
- return someWeeksAgo(weeks);
269
+ return inSomeWeeks(weeks);
269
270
  }
270
271
  if (seconds < year) {
271
272
  const months = Math.floor(seconds / month);
272
273
  if (months === 1) {
273
- return oneMonthAgo();
274
+ return inOneMonth();
274
275
  }
275
- return someMonthsAgo(months);
276
+ return inSomeMonths(months);
276
277
  }
277
278
  const years = Math.floor(seconds / year);
278
279
  if (years === 1) {
279
- return oneYearAgo();
280
+ return inOneYear();
280
281
  }
281
- return someYearsAgo(years);
282
+ return inSomeYears(years);
282
283
  };
283
- const formatDateFuture = seconds => {
284
+
285
+ // based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
286
+ const formatDatePast = seconds => {
284
287
  if (seconds < minute) {
285
288
  if (seconds === 1) {
286
- return inOneSecond();
289
+ return oneSecondAgo();
287
290
  }
288
- return inSomeSeconds(seconds);
291
+ return someSecondsAgo(seconds);
289
292
  }
290
293
  if (seconds < hour) {
291
294
  const minutes = Math.floor(seconds / minute);
292
295
  if (minutes === 1) {
293
- return inOneMinute();
296
+ return oneMinuteAgo();
294
297
  }
295
- return inSomeMinutes(minutes);
298
+ return someMinutesAgo(minutes);
296
299
  }
297
300
  if (seconds < day) {
298
301
  const days = Math.floor(seconds / hour);
299
302
  if (days === 1) {
300
- return inOneHour();
303
+ return oneHourAgo();
301
304
  }
302
- return inSomeHours(days);
305
+ return someHoursAgo(days);
303
306
  }
304
307
  if (seconds < week) {
305
308
  const days = Math.floor(seconds / day);
306
309
  if (days === 1) {
307
- return inOneDay();
310
+ return oneDayAgo();
308
311
  }
309
- return inSomeDays(days);
312
+ return someDaysAgo(days);
310
313
  }
311
314
  if (seconds < month) {
312
315
  const weeks = Math.floor(seconds / week);
313
316
  if (weeks === 1) {
314
- return inOneWeek();
317
+ return oneWeekAgo();
315
318
  }
316
- return inSomeWeeks(weeks);
319
+ return someWeeksAgo(weeks);
317
320
  }
318
321
  if (seconds < year) {
319
322
  const months = Math.floor(seconds / month);
320
323
  if (months === 1) {
321
- return inOneMonth();
324
+ return oneMonthAgo();
322
325
  }
323
- return inSomeMonths(months);
326
+ return someMonthsAgo(months);
324
327
  }
325
328
  const years = Math.floor(seconds / year);
326
329
  if (years === 1) {
327
- return inOneYear();
330
+ return oneYearAgo();
328
331
  }
329
- return inSomeYears(years);
332
+ return someYearsAgo(years);
330
333
  };
334
+
335
+ // based on https://github.com/microsoft/vscode/blob/bd782eb059e133d3a20fdb446b8feb0010a278ad/src/vs/base/common/date.ts (License MIT)
331
336
  const formatDate = (date, now) => {
332
337
  const difference = now - date;
333
338
  const seconds = Math.round(difference / 1000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "main": "dist/aboutWorkerMain.js",
6
6
  "type": "module",