summaryrefslogtreecommitdiff
path: root/node_modules/moment/src/lib/units/day-of-year.js
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-08-18 13:29:54 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-08-18 13:29:54 +0300
commitfd70f95224374d23157ee7c0357733102cd0df53 (patch)
treee490c12e021cedaf211b292d5d623baa32a673fc /node_modules/moment/src/lib/units/day-of-year.js
initialHEADmaster
Diffstat (limited to 'node_modules/moment/src/lib/units/day-of-year.js')
-rw-r--r--node_modules/moment/src/lib/units/day-of-year.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/node_modules/moment/src/lib/units/day-of-year.js b/node_modules/moment/src/lib/units/day-of-year.js
new file mode 100644
index 0000000..4fae6f4
--- /dev/null
+++ b/node_modules/moment/src/lib/units/day-of-year.js
@@ -0,0 +1,28 @@
+import { addFormatToken } from '../format/format';
+import { addRegexToken, match3, match1to3 } from '../parse/regex';
+import { addParseToken } from '../parse/token';
+import toInt from '../utils/to-int';
+
+// FORMATTING
+
+addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
+
+// PARSING
+
+addRegexToken('DDD', match1to3);
+addRegexToken('DDDD', match3);
+addParseToken(['DDD', 'DDDD'], function (input, array, config) {
+ config._dayOfYear = toInt(input);
+});
+
+// HELPERS
+
+// MOMENTS
+
+export function getSetDayOfYear(input) {
+ var dayOfYear =
+ Math.round(
+ (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
+ ) + 1;
+ return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
+}